Jump to content

Form Question


Recommended Posts

i made a simple survey form and i cant figure out how to make radio buttons work correctly in the form. All of the input is text, but there is one question on the form that asks for gender. I am a noob to php and i cant figure out how to make the radio buttons work.please help.

Link to comment
Share on other sites

for the radio button you can put this on your input form..

<input type="radio" name="gender" value="m"> Male<br><input type="radio" name="gender" value="f"> Female<br>

if you want use combo box..

<select name="gender">  <option value="m">Male</option>  <option value="f">Female</option></select>

then in php..

//this always worksecho $_REQUEST['gender']; //this works on POST method forms onlyecho $_POST['gender']; //this works on GET method forms onlyecho $_GET['gender'];

you'll get 'm' or 'f'...

Edited by viper_
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...