I have some code that I was given; there is a $_POST variable (email) that shows as having content, yet when I test for it using isset, it fails. I don\'t understand w
Take out the !
. That should fix it: if you enter a valid email you are negating true (which becomes false).
Keep in mind that when you use isset()
it returns a boolean (true or false)
Try :
if (empty($_POST['email'])) {
header("Location: "."error.php?msg=".rawurlencode("We did not find your information, please enter the needed information again."));
exit;
}
The reason why the redirect with header("Location: ...")
is not working is, that you already sent a header by echoing something.
Any header-redirection won´t work afterwards.