Reaper0167 Posted March 29, 2010 Share Posted March 29, 2010 a user can go back and update their profile, to display what they previously selected from the radio buttons, i use the following <?php if($gender_prof == 'male') { echo ' <input name="gender" type="radio" id="gender" value="male" checked="checked" /> male <input type="radio" name="gender" id="female" value="female" /> female'; } else { echo ''; } ?> <?php if($gender_prof == 'female') { echo ' <input name="gender" type="radio" id="gender" value="male" /> male <input type="radio" name="gender" id="female" value="female" checked="checked" /> female'; } else { echo ''; } ?> Is this an ok way to acomplish this, or is there a better way? Link to comment https://forums.phpfreaks.com/topic/196924-ok-to-do-this-way/ Share on other sites More sharing options...
schilly Posted March 29, 2010 Share Posted March 29, 2010 <input name="gender" type="radio" id="gender" value="male" <?php echo ($gender_prof == 'male') ? "CHECKED='CHECKED'" : ""; ?> /> <input name="gender" type="radio" id="gender" value="female" <?php echo ($gender_prof == 'female') ? "CHECKED='CHECKED'" : ""; ?> /> Link to comment https://forums.phpfreaks.com/topic/196924-ok-to-do-this-way/#findComment-1033864 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.