【发布时间】:2014-01-29 11:07:41
【问题描述】:
我的联系页面上有这个表格:
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$phone = $_REQUEST['phone'] ;
$message = $_REQUEST['message'] ;
mail("contact@*****.com", $name,
$message, "From:" . $email);
echo "Thank you for using our mail form. <br><br>We will get back to you within 48 hours.";
}
else
//if "email" is not filled out, display the form
{
echo "<br><form method='post' action='enquiry.php' align='center'>
<strong>Name: </strong><input class='textbox' name='name' type='text'><br><br>
<strong>Email: </strong><input class='textbox' name='email' type='text'><br><br>
<strong>Phone: </strong><input class='textbox' name='phone' type='text'><br><br>
<strong>Message: </strong><br>
<textarea class='textbox' name='message' rows='15' cols='40'>
</textarea><br>
<input type='submit'><br><br>
</form>";
}
?>
当有人提交表单时,它会向我发送一封电子邮件。
但是当我尝试将$phone 添加到我的电子邮件代码时。它无法将邮件发送给我。
有人可以告诉我在哪里可以添加这个吗?谢谢你。
【问题讨论】:
-
确保打开了 php 错误。还要发布您如何在代码中添加
$phone? -
显示两个不同的代码,用于两种不同的情况
-
您之前在哪里添加了您的电话号码 ($phone)?你能解释一下吗。你的问题不是很清楚。