我有一个网站。我想从我的客户那里获得表格细节...... 我正在准备一些代码。代码在某些主机面板上运行良好,但在我的主机面板中无效。 我认为有些功能不支持我的主机。 我报告托管服务提供商,但没有好的解决方案。 谁能解决这个问题...... 提前致谢
我的ads.html表单看起来像这样
<form action="advertisement-form.php" method="post" class="comment-form row-fluid" data-validate="parsley">
<p>
<label for="name" class="span2">Your Name</label>
<input type="text" class="span10" placeholder="Your Name" id="name" name="name" required >
</p>
<p>
<label for="email" class="span2">E-mail</label>
<input type="email" class="span10" placeholder="Your E-mail" id="email" name="email" required >
</p>
<p>
<label for="name" class="span2">Your Ad Title</label>
<input type="text" class="span10" placeholder="Ad Title" id="ad_title" name="ad_title" required >
</p>
<p>
<label for="site" class="span2">Target URL</label>
<input type="text" name="target_url" id="target_url" class="span10" data-type="url" required>
</p>
<p>
<label for="site" class="span2">Banner URL</label>
<input type="text" name="banner_url" id="banner_url" class="span10" data-type="url" required>
</p>
<p>
<label for="site" class="span2">Payment Email</label>
<input type="text" name="payment_email" id="payment_email" class="span10" data-type="url" required>
</p>
<p>
<label for="mess" class="span2">Message</label>
<textarea name="message" class="span10" data-trigger="keyup" data-rangelength="[20,1000]"></textarea>
</p>
<p>
<input type="submit" value="Continue" class="button button-load large-button offset2 span4">
</p>
</form>
我的表单处理看起来像这样,用ads-form.php命名
<?php
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "myemail@gmail.com";
$email_subject = "New Advertisement for Website";
// validation expected data exists
if(!isset($_POST['name']) ||
!isset($_POST['email']) ||
!isset($_POST['ad_title']) ||
!isset($_POST['target_url']) ||
!isset($_POST['banner_url']) ||
!isset($_POST['payment_email']) ||
!isset($_POST['message'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$name = $_POST['name']; // required
$email_from = $_POST['email']; // required
$ad_title = $_POST['ad_title']; // required
$target_url = $_POST['target_url']; // required
$banner_url = $_POST['banner_url']; // required
$payment_email = $_POST['payment_email']; // not required
$message = $_POST['message']; // required
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Name: ".clean_string($name)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Ad Title: ".clean_string($ad_title)."\n";
$email_message .= "Target URL: ".clean_string($target_url)."\n";
$email_message .= "Banner URL: ".clean_string($banner_url)."\n";
$email_message .= "Payment Email: ".clean_string($payment_email)."\n";
$email_message .= "Message: ".clean_string($message)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
当用户填写表单时,他获得了成功消息。但我没有收到确认邮件。这个脚本工作一些主机面板,而不是我的主机面板。任何一个解决这个...
再次感谢你。
答案 0 :(得分:0)
我会建议您尝试使用n<-gsub("^\\{+(.+)\\}+$", '\\1', iarray)
结束每一行,并添加 To 标头(看似多余)。另外,在标题中声明n2 <- strsplit(n, ",")
就足够了。
\r\n
此功能还是charset=utf-8
而非 $headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=utf-8\r\n";
// Additional headers
// This might look redundant but some services REALLY favor it being there.
$headers .= "To: $to_fullname <$to_email>\r\n";
$headers .= "From: $from_fullname <$from_email>\r\n";
答案 1 :(得分:0)
1 - 更改
1) index.html#page=home
2) index.html#page=topic?secid=1&catid=1
到
died('We are sorry, but there appears to be a problem with the form you submitted.');
2-删除@之前的邮件功能。在任何语句之前使用@将在出现任何错误时抑制错误。所以,如果你删除它..很容易排除故障。 按照上面的两个步骤再试一次。如果您看到任何错误,请将其粘贴到此处