I'm doing something very similar to this site here。当您发送页脚中的表单时,成功发送后会出现一个模式窗口,感谢用户提交表单。我已经在基金会中建立了一个网站,并正在使用Abide.js验证字段。
今天早上一切正常,直到我尝试使用不同的AJAX/jQuery方法使一条消息出现在表单所在的页面上,而不是模式页面上。现在,我正在尝试执行模式,但我的表单根本无法工作。
下面是我的表单的HTML:
<form id="form-contact" name="form-contact" action="include/contact-form-send.php" method="post" data-abide>
<div class="row">
<div class="large-12 columns">
<input id="contact-name" name="name" type="text" placeholder="Full Name" pattern="alpha" required />
</div>
</div>
<div class="row">
<div class="large-12 columns">
<input id="contact-email" name="email" type="text" placeholder="Email Address" pattern="email" required />
</div>
</div>
<div class="row">
<div class="large-12 columns">
<input id="contact-phone" name="phone" type="text" placeholder="Phone Number" pattern="number" required />
</div>
</div>
<div class="row">
<div class="large-6 medium-6 small-12 columns" id="form-left">
<input id="contact-security" name="security" type="text" placeholder="10 - 3 =" pattern="[7]" required />
</div>
<div class="large-6 medium-6 small-12 columns" id="form-right">
<input type="submit" value="submit" class="button green-button" id="form-send" />
</div>
</div>
PHP:
$name = $_POST["name"];
$email = $_POST["email"];
$phone = $_POST["phone"];
$to = "example@email.com";
$subj = "The Rivers Quick Contact Request";
$mess = "The following person has filled out the quick contact form on The Rivers website:
Name: $name
Email: $email
Phone: $phone
";
$headers = "From: info@therivers.com" . "\r\n" .
"CC:example@email.com";
$mailsend = mail($to,$subj,$mess,$headers);理想情况下,JS行将帮助在发送表单时显示模式,即using a function as defined by Foundation here.
$(document).ready(function() {
$('#form-contact').on('valid.fndtn.abide', function() {
$('.modal').css({'opacity':'1'});
});
});我的理解是,Abide.js应该负责所有的验证,然后PHP文件会将表单发送到指定的电子邮件。既然我把它弄坏了,我就不知道该往哪里走了。
发布于 2014-07-19 06:02:57
我认为我们遗漏了太多代码,不能提供太多帮助:/
当我转到提供的链接时,您的php错误在第19行,但没有提供19行php。
你检查过你的php语法了吗?如果不是,则返回here's a php syntax checker。
关于调用modal,你有没有尝试过基金会的calling插件?Check it out if you haven't。
顺便说一句,看起来很棒的网站!
https://stackoverflow.com/questions/24747374
复制相似问题