Get Radio button value in PHP
Description
The following code shows how to get Radio button value.
Example
<HTML>/*from ww w .ja v a2s.co m*/
<BODY>
<FORM ACTION="SelectFormControlHandler.php" METHOD="POST">
What's your most favorite kind of candy?<BR>
<INPUT TYPE="radio" NAME="Candy" VALUE="peanut butter cups">Peanut butter cups<BR>
<INPUT TYPE="radio" NAME="Candy" VALUE="Snickers">Snickers<BR>
<INPUT TYPE="radio" NAME="Candy" VALUE="Turtles">Turtles<BR>
<INPUT TYPE="submit">
</FORM>
</BODY>
</HTML>
The following code is for SelectFormControlHandler.php.
<HTML>/* w w w . j a v a2s . c o m*/
<BODY>
Yum, <?php print("$Candy! ");
if($Candy == "peanut butter cups"){
print("peanut butter cups");
print(" $Candy.");
}else{
print("$Candy");
if($Candy == "Snickers"){
print("Snickers");
}elseif($Candy == "Turtles"){
print("Turtles");
}
}
?>
</BODY>
</HTML>