Blekk Posted December 9, 2006 Share Posted December 9, 2006 Hi,In my form, the user is logged in, there is a "send to email address?" checkbox, if checked it sends to their email...obviously (the email address is in the users record in the database). But now I want to make this selection into two Radio Buttons, one for "send to email address?" and "send to different email address?" with a textbox underneath.What I would like to know is how to retrieve data from two radio buttons say $radio1 and $radio2, I tried the checkbox way of:[code]if(isset($_POST['radio1']));{print "radio1 was selected";}if(isset($_POST['radio2']));{print "radio2 was selected";}[/code]But this meant that I could select both radio buttons at the same time, not what I am looking for.Is it something like a select box? So that two options cant be chosen twice?like:[code]<select name="select"><object value="hello">Hello</object><object value="goodbye">Goodbye</object></select>[/code]Thanks,Any reply is appreciated. Link to comment https://forums.phpfreaks.com/topic/30050-how-to-use-a-radio-button-in-php/ Share on other sites More sharing options...
hitman6003 Posted December 9, 2006 Share Posted December 9, 2006 The html:[code]<input type="radio" name="emailto" value="me"> Send to my email<br /><input type="radio" name="emailto" value="you"> Send to someone else[/code]the php:[code]echo $_POST['emailto'];[/code] Link to comment https://forums.phpfreaks.com/topic/30050-how-to-use-a-radio-button-in-php/#findComment-138166 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.