Hi guys,
I’m having truble to update my profile page that has two radio buttons for gender selection, one for male and the other for female, I’ve got the update function to work based on the selection, but I can’t figure out how to update the radio button so that once a user returns to their profiles page, the correct selected radio button would be selected, instead now both appear un-selected.
Here’s my code.
<?php
$male_status = 'unchecked';
$female_status = 'unchecked';
if (isset($_POST['Submit1'])) {
$selected_radio = $_POST['gender'];
if ($selected_radio == 'male') {
$male_status = 'checked';
}
else if ($selected_radio == 'female') {
$female_status = 'checked';
}
}
?>
<p>Male:</p>
<input id="mgender" name="gender" title="Gender Type: Male" type="radio" value="male" <?php echo $male_status; ?>/>
<p>Female:</p>
<input id="fgender" name="gender" title="Gender Type: Female" type="radio" value="female" <?php echo $female_status; ?>/>
</div>