Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用php sendmail脚本,邮件发送,但电子邮件中没有表单内容_Php_Forms_Sendmail - Fatal编程技术网

使用php sendmail脚本,邮件发送,但电子邮件中没有表单内容

使用php sendmail脚本,邮件发送,但电子邮件中没有表单内容,php,forms,sendmail,Php,Forms,Sendmail,我使用以下脚本发送一个非常大的表单的php sendmail。它发送电子邮件,进行确认,但电子邮件不包含任何表单字段。我是php的新手,所以不知道如何修复它 我尝试过其他脚本,但都没有发送…所以我又回到了这个脚本。我不知道足够的php来修复它。此表格应通过开放式房地产的CMS页面提交。在主机删除他们的sendmail脚本并表示由于升级需要将其切换到php sendmail之前,它确实起到了作用 <?php if(!isset($_POST['submit'])) echo "err

我使用以下脚本发送一个非常大的表单的php sendmail。它发送电子邮件,进行确认,但电子邮件不包含任何表单字段。我是php的新手,所以不知道如何修复它

我尝试过其他脚本,但都没有发送…所以我又回到了这个脚本。我不知道足够的php来修复它。此表格应通过开放式房地产的CMS页面提交。在主机删除他们的sendmail脚本并表示由于升级需要将其切换到php sendmail之前,它确实起到了作用

<?php   

if(!isset($_POST['submit']))
echo "error; you need to submit the form!";
{
} 
$name = $_POST['name']; 
$visitor_email = $_POST['email'];
$message = $_POST['message'];


if(empty($name)||empty($visitor_email)) 
{
echo "Name and email are mandatory!";
exit;
}

if(IsInjected($visitor_email))
{
echo "Bad email value!";
exit;
}

$email_from = $_POST['email']; //<== update the email address
$email_subject = "Application from PRN ";
$email_body = "You have received a new message from the user 
$name.\n".

$to = 'test@example.com';//<== update the email address
$headers = "From: $email_from \r\n";
$headers .= "Reply-To: $visitor_email \r\n";

mail($to,$email_subject,$email_body,$headers);
//done. redirect to thank-you page.
header('Location: http://example.com/example/index.php? 
action=page_display&amp;PageID=23');

?> 

html格式表单的缩写版本,表单很长:

<form method="post" name="myemailform" action="form-to-email.php"> 

 <p><input name="Volunteer Form" type="hidden" value="Volunteer Application" /> <label>Name <input id="name" name="name" size="48" style="width: 604px; height: 28px;" type="text" /> </label></p>

<p><label>Address: <input id="address" name="address" size="15" style="width: 583px; height: 28px;" type="text" /> </label></p>
 <label> <input id="community_events" name="community_events" type="checkbox" /> Represent PRN at Community Events</label> <label> <input id="baker" name="baker" type="checkbox" /> Baker</label><br />
<label><input id="other" name="other" type="checkbox" /> Other - Specify in Comments Section</label> <label> <input id="any_way" name="any_way" type="checkbox" /> Willing to help in any way that helps the Pugs. Just ask!</label></p>

<p align="left">Please list any skills you may have that would help the Pug Rescue Network (i.e. sewing, scrapbooking)</p>

<p align="left"><label><textarea cols="75" id="any_skills" name="any_skills" rows="5"></textarea></label></p>

<p align="left">Comments:</p>

<p align="left"><label><textarea cols="75" id="comments" name="comments" rows="5"></textarea></label></p>
<input name="submit" type="submit" value="submit" /><input name="redirect" type="hidden" value="http://example.com/example/index.php?action=page_display&amp;PageID=23 " /></p>
</form> 

名字

地址:

代表PRN参加社区活动
其他-在评论部分指定愿意以任何方式帮助哈巴狗的人。问吧

请列出有助于帕格犬救援网络的任何技能(如缝纫、剪贴簿)

评论:

这是我收到的电子邮件。(收件人、发件人标题可以)它不显示表单,而是显示发送到的电子邮件。网站上有3个不同的长表单,如果可能,希望使用相同的发送邮件脚本提交所有表单。(申请、志愿者、寄养人)

电子邮件:

您已收到来自用户示例的新消息

信息如下:


test@example.com

难道你没有忘记将$message变量添加到$email\u body吗


“您收到了来自用户“$name”的新消息。\n”$信息

我没有写脚本…不知道我明白你的意思吗?我将$message添加到该行,它将不再提交。还有其他地方需要添加吗?我的php知识非常有限-零零碎碎地学习如何将$message var添加到$email\u body?将$email\u body行替换为$email\u body=“您收到了来自用户的新消息”$名字$消息我确实改变了你的建议,但是它仍然提交电子邮件,但没有表格。电子邮件上写着:您收到了来自用户(姓名)的新消息。没别的了。它仍然显示名称,而不是表单。可能是服务器上有什么东西在剥离表单吗?他们告诉我,除非我告诉他们需要安装/更改什么,否则他们不会提供帮助,而我没有足够的经验去做。(霍斯盖特)