联系表单未发送表单值
Contact form not sending form values
我使用的是来自codrops的stepsForm.js的升级版本。无论如何,联系人表单发送电子邮件,但没有来自输入的值,即$_POST['email']
。PHP。。。
<?php
$field_email = $_POST['email'];
$field_name = $_POST['name'];
$field_residence = $_POST['residence'];
$field_profession = $_POST['profession'];
$field_club = $_POST['fave_club'];
$field_message = $_POST['message'];
$mail_to = 'idwapro2@gmail.com';
$subject = 'Message from vidz.dundaah visitor '.$field_name;
$body_message = 'E-mail: '."'n".$field_email."'n'n";
$body_message .= 'Name: '."'n".$field_name."'n'n";
$body_message .= 'Residence: '."'n".$field_residence."'n'n";
$body_message .= 'Profession: '."'n".$field_profession."'n'n";
$body_message .= 'Fave_club: '."'n".$field_club."'n'n";
$body_message .= 'Message: '."'n".$field_message;
$headers = 'From: '.$field_name."'r'n";
$headers .= 'Reply-To: '.$field_email."'r'n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
?>
<script type="text/javascript">
window.location = '../contact.html';
</script>
<?php
?>
HTML表单…和js文件步骤form.js和css文件步骤form.css
<section class="cool_form">
<form action="css/contactForm.php" id="theForm" class="simform" autocomplete="off">
<div class="simform-inner">
<ol class="questions">
<li>
<span><label for="q1">What's your email?</label></span>
<input id="q1" name="email" type="email" spellcheck="false" />
</li>
<li>
<span><label for="q2">What's your name?</label></span>
<input id="q2" name="name" type="text" spellcheck="false" />
</li>
<li>
<span><label for="q3">Where do you live?</label></span>
<input id="q3" name="residence" type="text" spellcheck="false" />
</li>
<li>
<span><label for="q4">What do you do?</label></span>
<input id="q4" name="profession" type="text" spellcheck="false" />
</li>
<li>
<span><label for="q5">Favourite club?</label></span>
<input id="q5" name="fave_club" type="text" spellcheck="false" />
</li>
<li>
<span><label for="q6">Tell us something...</label></span>
<input id="q6" name="message" type="text" spellcheck="false" />
</li>
</ol>
<button class="submit" type="submit">Send answers</button>
<div class="controls">
<button class="previous"></button>
<button class="next"></button>
<div class="progress"></div>
<span class="number">
<span class="number-current"></span>
<span class="number-total"></span>
</span>
<span class="error-message"></span>
</div>
</div>
<span class="final-message"></span>
</form>
</section>
基本上得到了"电子邮件:空白","姓名:空白…"等等,谢谢!
您需要将method="post"
添加到HTML <form>
标记中。除非您指定使用不同的HTTP请求方法,否则表单将默认为$_GET
。如果你在提交现有表单后查看地址栏,你可能会在URL中看到所有提交的参数。
以下是您的<form>
标签的外观:
<form action="css/contactForm.php" id="theForm" class="simform" autocomplete="off" method="post">
像一样使用值为post
的表单的method
属性
<form method="post" ......
相关文章:
- PHP-每天只有2小时的活动联系表单
- 使用AngularJs,尝试通过Google App Engine上的PHP使用HTML联系我们表单发送电子邮件
- 限制每秒/分钟联系表单电子邮件
- JS验证后空联系表单
- 联系表单代码自定义
- 联系表单未发送表单值
- PHP表单适用于索引,但不适用于联系我们页面
- 联系表单Javascript/Ajax/PHP不是't工作
- 使用PHP、jQuery和AJAX的Bootstrap联系表单
- AJAX的联系表单在Wordpress中不起作用
- 联系表单打开PHP文件而不是显示弹出窗口
- 使用 javascript 重定向联系表单 7
- 联系表单不起作用(Php 端)
- 将 PHP 联系表单加载到位于单独 HTML 页面上的 Iframe 中
- Ajax/PHP 联系表单空白字段
- 使用模态弹出联系表单,是否可以在提交时在同一弹出窗口中显示确认
- 联系表单提交错误
- 在PHP联系表单中调用Javascript
- JavaScript 可以工作,但联系表单仍然发送邮件
- 在 Angular 中使用 Nodemailer 创建联系表单