我已经汇总了一个电子邮件表单但由于某种原因我收到了以下错误。
注意:未定义的索引:第7行的/home/furniss11/public_html/sendform.php中的电子邮件
注意:未定义的索引:第8行/home/furniss11/public_html/sendform.php中的名称
注意:未定义索引:第9行/home/furniss11/public_html/sendform.php中的消息
注意:未定义索引:第12行/home/furniss11/public_html/sendform.php中的消息
注意:未定义的索引:第13行/home/furniss11/public_html/sendform.php中的消息
我似乎无法找到我在这里做错了什么。
这是HTML
<form id="form" method="POST" action="sendform.php">
<p class="name">
<input type="text" name="name" id="name" placeholder="Enter Name Here"/>
<label for="name"> Name: </label>
</p>
<p class="email">
<input type="email" name="email" id="email" placeholder="Enter Email Here"/>
<label for="email"> Email Address: </label>
</p>
<p class="message">
<textarea id="message" name="message" rows="6"> </textarea>
<label for="message"> Message: </label>
</p>
<p class="submit">
<input type="submit" name="submit" value="SEND" id="submit"/>
</p>
</form>
这是PHP
$recipients = "*****";
$to = $recipients; // this is your Email address
$from = $_POST['email']; // this is the sender's Email address
$name = $_POST['name'];
$message = $_POST['message'];
$subject = "Web-Development Hub Feedback";
$subject2 = "Copy of your feedback";
$message = $name . " " . " wrote the following:" . "\n\n" . $_POST['message'];
$message2 = "Here is a copy of your message " . $name . "\n\n" . $_POST['message'];
$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender;
echo $name;
有人可以解释为什么我会得到未定义的变量吗?
非常感谢