尝试在PHP中使用mail()函数时出错

时间:2019-03-31 21:07:22

标签: php

注意:未定义的变量:第9行的/storage/ssd2/786/9097786/public_html/feedback_script.php中的标头

我的html和php位于单独的文件中

我的代码:

<html>
<head>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
</head>
<h1>Basic Website Feedback Form</h1>
<form action="feedback_script.php" method="post" name="feedback_form" id="feedback_form">
 <p>E-Mail:</p>
 <input name="email_address" type="text" id="email_address"/></td>
 <p>Feedback:</p>
 <textarea name="feedback_text" rows="5"  id="feedback_text"></textarea>
 <input name="Send" type="submit" id="Send" value="Submit" />
</form>
</html>


<?php
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = $_POST['email_address'];
$to ='lucaswilson4502@outlook.com';
$subject = "Some Feedback";
$message = $_POST['feedback_text'];
$headers = "From:" . $from;
$send_contact=mail($to,$subject,$message,$header);
if($send_contact){
    echo "We have received your feedback, Thank you very much!";} 
else {
    echo "Oops! There was an error";
}
?>

任何帮助您确定问题的帮助将不胜感激,如果我犯了任何愚蠢的错误,我对此表示歉意,我是PHP新手。

0 个答案:

没有答案