Jump to content
moriahcgibbs

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.

Share this post


Link to post
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_

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...