I know I shouldn't echo before calling header but I do not.
I know the function is working since if I replace header with echo "ok" / "not" ok it works (IE echo ok if it is supposed to and echo not ok if it is supposed to.
I can get one step to work if i put the header('Location: main.php') on top of the page and only call exit within the if statement but then I have no way to redirect to reject.php.
Code: Select all
<?php
include_once 'connect_db.php';
include_once 'incs.php';
sec_session_start();
if (isset($_POST $_POST['pw'],['userID'])) {
$pass = $_POST['pw'];
$id = $_POST['id'];
if (login($pass, $id, $mysqli) == ok) {
header("Location: main.php");
exit;
} else {
header("Location: reject.php");
exit;
}
}
?>
Am I really that stupid or is there something wrong with the header command... oh and I tried with " ' and combinations within the header().. I know the header path is ok though bacause it works if i declare the header on top of the page and only call exit within the if block...
So what am I doing wrong?