I have two radio buttons in my program but when i run it none of them is checked, I want one of them to be checked by default,
how can i achieve this ?
<li><input type="radio" name="r1" value="o" onClick="submit();" <?php echo ($_SESSION['r1'] == "o") ? 'checked="checked"' : ''; ?> />On</li>
<li><input type="radio" name="r1" value="p" onClick="submit();" <?php echo ($_SESSION['r1'] == "p") ? 'checked="checked"' : ''; ?> />Off</li>
I want the ‘On’ button to be checked when i open the page for the first time
Here you go:
Something like this:
What about this:
Well, in order for the On button to checked, the
$_SESSION['r1']
must be equal to “o”. Have you checked the value of$_SESSION['r1']
?