I have a checkbox flip switch like this:
<form>
<input type="text" name="control_name[]"/>
<label for="flip-checkbox-4">Flip toggle switch checkbox:</label>
<input type="checkbox" data-role="flipswitch" name="control_name_switch[]" id="flip-checkbox-4" checked=""/>
</form>
the form is read with this php code:
if (!empty($_POST)) {
$controlname = $_POST['control_name'];
$controlstate = $_POST['control_name_switch'];
$program = $_POST['program'];
$i = 0;
$ctrlSize = sizeof($controlname);
for ($i = 0; $i < $ctrlSize; $i++) {
if (empty($_POST['control_name_switch'])) {
$controlstate[$i] = " ";
} else {
$controlstate[$i] = "checked";
}
}
When I read the post in a php, I get it to be always "on" even if i have clicked it and turned it off. Please help.