PHP无法从邮件程序返回值

时间:2018-05-28 14:34:59

标签: php get phpmailer

我的网站上有联系表格。 我想让PHP邮件工作在我从表单获取输入的地方,返回1表示成功否则错误地返回-1 。我想要包含它,我收集了邮件文件。

这是我遇到的错误。

  

注意:未定义的索引:C:\ xampp \ htdocs \ omnifood \ index.php

成功

这个php代码获取mailer.php文件返回的值。

<?php

    if($_GET['success'] == 1){
        echo "<div class=\"form-message success\"> Thank you. Your message has been sent ! </div>";
    }
   if($_GET['success'] == -1){
        echo "<div class=\"form-message error\"> Opps! Something went wrong. Please try again. </div>";
    } 

?>

如果发生任何错误,这是返回值的代码。

if (empty($name) OR empty($message) OR !filter_var($email, FILTER_VALIDATE_EMAIL)) {
        header("Location: localhost:8080/omnifood/index.php?success=-1#form");
        exit;
    }

成功发送邮件后,它将返回。

header("Location: localhost:8080/omnifood/index.php?success=1#form");

0 个答案:

没有答案