Why is my page not redirecting on success

前端 未结 3 926
星月不相逢
星月不相逢 2021-01-24 07:57

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

相关标签:
3条回答
  • 2021-01-24 08:25

    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)

    0 讨论(0)
  • 2021-01-24 08:26

    Try :

    if (empty($_POST['email']))  {  
    header("Location: "."error.php?msg=".rawurlencode("We did not find your information, please enter the needed information again."));
    exit;
    } 
    
    0 讨论(0)
  • 2021-01-24 08:31

    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.

    0 讨论(0)
提交回复
热议问题