PHP无法从mailer获取返回值

PHP无法从mailer获取返回值,php,get,phpmailer,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\"> T

我的网站上有一张联系表。 我想让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>";
} 
?>
成功发送邮件后,它将返回

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

您应该检查键
success
是否存在于数组
$\u GET
中。例如,你可以做
isset($\u GET['success'])
这基本上意味着url中没有
success
这样的东西。你确定你要把它寄出去?
header("Location: localhost:8080/omnifood/index.php?success=1#form");