Hey there, I've been trying to find the cause of the problem but couldn't. needed help from experts out there. the code supposed to echo it's submitted value on the same form when the checkbox is changed.
here's the code:
<!DOCTYPE html>
<?php
$office = $_POST["office"];
echo $office;
?>
<html>
<body>
<?php
if (isset($office)) {
echo "ON<br>";
} else {
echo 'OFF<br>';
}
?>
<form name="checkbox" method="POST" action="interfaceButton.php" enctype="multipart/form-data">
<?php
if(isset($office)){
echo "asdfaf";
echo "<input type='checkbox' name='office' value='on' checked onclick='this.form.submit();'";>
}
else{
echo '<input type="checkbox" name="office" value="" onClick="submit();"';}
?>
</form>
</body>
</html>
Was going to make use this concept and replace the input like a switch button for an web automation project. but im stuck here.
output given when code was tried was:
"; } else { echo 'OFF '; } ?> } else{ echo '<input type="checkbox" data-cke-saved-name="office" name="office" value="" ';}="" ?="">