|
Posted by Shelly on 10/10/06 00:33
I have used radio buttons often in the past, but now I am having problems.
Please, someone, look at this simple code and tell me where I am going
wrong. I cannot retrieve the posted value of gender when I click either
button (male or female)
I have tried (in desperation)
1 - removing the target statement on the form.
2 - adding [] to become name="gender[]".
3 - changing the values to 1 and 2.
Nothing is working. It must be something extremely simple and obvious, but
I just can't see it.
This has worked for me many times in the past. Does anyone see ANYTHING?
The complete code is below between the "******" lines, and can be cut and
pasted.
Shelly
*******************************
<?php
if (isset($_POST['update'])) {
$gender = $POST['gender'];
echo "gender=" . $gender . "<br>";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<form action="" method="post" name="properties" TARGET="_SELF">
<table>
<tr>
<td>Male<input type="radio" name="gender" value="M">
Female<input type="radio" name="gender" value="F"></td>
</tr>
<tr align="center">
<td colspan="2"><input type="submit" name="update" value="Update"></td>
</tr>
</table>
</form>
</body>
</html>
*********************************
Navigation:
[Reply to this message]
|