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? Quote Link to comment 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'" : ""; ?> /> 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.