tags:

views:

40

answers:

1

I used a form generator to create a simple for me to work with. I noticed that my radial and checkbox buttons didnt seem to be working. EDIT: This is out of my HTML DOC

this is what i have for my buttons:

<tr><td><label><input type='radio' name='gender'  value='male'>Male</label></td></tr>
<tr><td><label><input type='radio' name='gender'  value='female'>Female</label></td></tr>

when i try echoing the value in php with $_POST['gender'] call nothing comes up. I've also tried "IF....ELSE" statements to get this to work but the ELSE clause is always returned.

also before the two buttons were formated like this, the name and value attributes were actually echo commands enclosed in tags. I tried turning the page from a html to a php file and change the tags to tags, but that didn't help (i knew that was a long shot)

I couldn't google up any information about why this is happening so i hope the good people of stack overflow can help me. Im pretty new to programming, especially web programming, but it kills be to get stumped by something so easy!

edit: So you know, this is what have in my PHP file:

$gender = $_POST["gender"]; 

if($gender == "male")
      {echo "male </br>";}
else
      {echo "female </br>";}
+2  A: 

Well for one, you have your quotes nested wrong:

"<tr><td><label><input type='radio' name='gender'  value='male'>Male</label></td></tr>"
"<tr><td><label><input type='radio' name='gender'  value='female'>Female</label></td></tr>"

Also, on some browsers (IE), wrapping the input with label causes errors. You should move the inputs outside the label.

Aaron Harun
strang that this happened... very unexpected... thank you
tony_p