In addition to the supplied answer(s), I would like to suggest doin the following:
// Before anything else, start your session
if (!isset($_SESSION)) {
session_start();
}
// Next, check if your form is actually submitted
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_POST['...'])) {
} elseif (isset($_POST['...'])) {
}
}
?>
<!-- Keep PHP and html seperated -->
<form>
...
</form>
By looking at your form, i notice that you are using type="button"
. I suggest one of the following:
<input type="submit" ... />
<button type="submit">...</button>
solved php ‘ISSET’ function not working. OR the code skips my if statements