siddscool19 Posted September 21, 2008 Share Posted September 21, 2008 <html> <body> <form method=get> <input type=radio name=gender id=male >Male</br> <input type=radio name=gender id=female >Female</br> <input type=submit value=Submit> </form> </body> </html> <?php $gender=$_GET["gender"]; echo $gender ?> Now i want the value of only <input type=radio name=gender id=male > .. What coding is to be used? Quote Link to comment Share on other sites More sharing options...
ratcateme Posted September 21, 2008 Share Posted September 21, 2008 add a value field to your buttons so one is value=male... Scott. Quote Link to comment Share on other sites More sharing options...
siddscool19 Posted September 21, 2008 Author Share Posted September 21, 2008 That i don't want to do......... I just want that if field come from male then it accepts otherwise it doesn't accepts how to do that? Quote Link to comment Share on other sites More sharing options...
chronister Posted September 21, 2008 Share Posted September 21, 2008 You HAVE to add a value= to your radios otherwise they have no value <input type=radio name=gender value="male" id=male >Male</br> <input type=radio name=gender value='female" id=female >Female</br> Then do this.... <?php $gender = $_GET['gender']; if($gender == 'male') { echo 'Its a boy!!'; } else { echo 'Throw her back'; } ?> Basic HTML structure and php comparison operators. Nate Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.