ki Posted February 28, 2007 Share Posted February 28, 2007 Okay im setting up a user avatar thing for my site kinda like how this one is. How does php react to choices? I use isset(empty(!$_POST['check'])) to check is check box is checked, idk if its the same format or not? Any help? Link to comment https://forums.phpfreaks.com/topic/40537-choices/ Share on other sites More sharing options...
itsmeArry Posted February 28, 2007 Share Posted February 28, 2007 if a checkbox is checked then only you will get the value for that check box in POST array otherwise you will not find it in POST array so you can check this..... if(isset($_POST['check'])) this will do... Link to comment https://forums.phpfreaks.com/topic/40537-choices/#findComment-196162 Share on other sites More sharing options...
monk.e.boy Posted February 28, 2007 Share Posted February 28, 2007 do a: print_r( $_POST); to see what you are getting. Take (or comment) out this line when you are ready to go live. monk.e.boy Link to comment https://forums.phpfreaks.com/topic/40537-choices/#findComment-196163 Share on other sites More sharing options...
ki Posted February 28, 2007 Author Share Posted February 28, 2007 No I used that for my check box im talking about an Option button Link to comment https://forums.phpfreaks.com/topic/40537-choices/#findComment-196165 Share on other sites More sharing options...
willpower Posted February 28, 2007 Share Posted February 28, 2007 Your html form will have an id/name value attached to the select...or at least it should have. <select name="mynameforthisselect"> Now to get the values you simpley use if (isset($selectvalue=$_POST['mynameforthisselect']) { //do this } else { //do that } Link to comment https://forums.phpfreaks.com/topic/40537-choices/#findComment-196203 Share on other sites More sharing options...
boo_lolly Posted February 28, 2007 Share Posted February 28, 2007 i would use radio buttons, not a dropdown menu. Link to comment https://forums.phpfreaks.com/topic/40537-choices/#findComment-196250 Share on other sites More sharing options...
ki Posted February 28, 2007 Author Share Posted February 28, 2007 bah im sorry thats what i mean, radio buttons, I really never knew the name but it just now sparked in my head Link to comment https://forums.phpfreaks.com/topic/40537-choices/#findComment-196299 Share on other sites More sharing options...
willpower Posted February 28, 2007 Share Posted February 28, 2007 the same rule applys. you should have a name for your radio group. ie <input type="radio" name="radioGroup1" value="option1" /> <input type="radio" name="radioGroup1" value="option2" /> <input type="radio" name="radioGroup1" value="option3" /> PHP if (isset($selectvalue=$_POST['radioGroup1']) { echo $_POST['radioGroup1']; } else { //do that } Link to comment https://forums.phpfreaks.com/topic/40537-choices/#findComment-196305 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.