denoteone Posted March 10, 2009 Share Posted March 10, 2009 what sort of php if statement can I use to make sure that on submit the user has atleast select yes or no <INPUT TYPE=RADIO NAME="otherdata" VALUE="Yes">YES<br/> <INPUT TYPE=RADIO NAME="otherdata" VALUE="No">NO<br/> would it check to see if it is null? any help would be awesome. thanks, Quote Link to comment https://forums.phpfreaks.com/topic/148848-solved-input-typeradio/ Share on other sites More sharing options...
premiso Posted March 10, 2009 Share Posted March 10, 2009 Javascript, not html or php. If you want php to check it (it would require a pagereload). if (!isset($_POST['otherdata']) || ($_POST['otherdata'] != "Yes" && $_POST['otherdata'] != "No")) { echo "Required field missing."; } But you probably want Javascript instead. Quote Link to comment https://forums.phpfreaks.com/topic/148848-solved-input-typeradio/#findComment-781622 Share on other sites More sharing options...
socratesone Posted March 10, 2009 Share Posted March 10, 2009 A quick way to do this is just to use a default value. I don't know if this is the behavior you want, though. <INPUT checked="checked" TYPE=RADIO NAME="otherdata" VALUE="Yes">YES<br/> <INPUT TYPE=RADIO NAME="otherdata" VALUE="No">NO<br/> Quote Link to comment https://forums.phpfreaks.com/topic/148848-solved-input-typeradio/#findComment-781650 Share on other sites More sharing options...
denoteone Posted March 11, 2009 Author Share Posted March 11, 2009 premiso since the radio buttons are in a larger form on the submit of that form I just check to make sure that variable other data is at least equal to one... That makes sense I am not sure why I thought it was harder. thanks, Quote Link to comment https://forums.phpfreaks.com/topic/148848-solved-input-typeradio/#findComment-781958 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.