I have a pretty basic function on my website where a user ticks a box, and if the box is ticked, it will carry out a query and unset a session. If it's not, it won't execute the query, but it will destroy the session.
It's pretty basic, but for some reason, PHP isn't registering if the checkbox is unchecked. It will work if it is checked, just not the latter.
This is my PHP:
if(isset($_POST) && !empty($_POST)){
$la = ($_POST['la'] == "on") ? 1 : 0; // if the box is checked, return 1. if not, return 0
if($la == 1 || $la == 0){
if($la == 1){
// where I execute the query...
session_start();
session_unset();
session_destroy();
redirect('./');
exit();
} else if($la == 0) {
session_start();
session_unset();
session_destroy();
redirect('./');
exit();
}
} else {
redirect('./');
}
}
All help is appreciated :)