I have two switches in my program, but when I run it, none of them are 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
source
share