<form method="POST">
<input type="checkbox" id="hrm" name="hrm" />
</form>
I mean when the form is posted.
<form method="POST">
<input type="checkbox" id="hrm" name="hrm" />
</form>
I mean when the form is posted.
This how:
<?PHP
if($_POST['hrm']=='ok') echo 'checked';
else echo 'not';
?>
or:
<?PHP
if(isset($_POST['hrm'])) echo 'checked';
else echo 'not';
?>
But first you have to give value for it:
<input type="checkbox" id="hrm" name="hrm" value='ok' />
<input type="checkbox" id="hrm" name="hrm" value="yes" />
<?php
if ( isset( $_POST['hrm']) && $_POST['hrm'] === 'Yes' ) {
}
?>
$_GET['hrm']
or $_POST['hrm']
(depending on your form's method attribute) will be set to 'On' if it is checked, or will not be set at all if it's unchecked. In essence, you can just check using isset($_GET['hrm']) (or _POST if that's the case) - if isset() returns true, then it was checked.