我有一個使用Jquery表單插件的基本聯繫表單。我無法使用插件提交它。它只提交如果我添加一個PHP包括process.php。Jquery表單插件沒有提交到進程頁面
的Javascript:
$(document).ready(function() {
$("#contact").validate({
submitHandler: function(form) {
$(form).ajaxSubmit({
url:"process.php",
type:"post",
});
}
});
});
這裏是我的聯繫方式:
<form id="contact" method="post" name="validation" action="contact.php" onsubmit="return validateForm();">
<fieldset>
<label for="name">Name</label>
<input type="text" name="name" placeholder="Full Name" title="Enter your name" class="required">
<label for="email">E-mail</label>
<input type="email" name="email" placeholder="[email protected]" title="Enter your e-mail address" class="required email">
<label for="phone">Phone</label>
<input type="tel" name="phone" placeholder="ex. (555) 555-5555">
<label for="message">Question/Comment</label>
<textarea name="message"></textarea>
<input type="submit" name="submitted" class="button" id="submit" value="Send Message" />
</fieldset>
</form>
Process.php
<?php
function GetHeaders()
{
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'From: Company Name<[email protected]>' . "\r\n";
return $headers;
}
// Get Data
$name = strip_tags($_POST['name']);
$email = strip_tags($_POST['email']);
$phone = strip_tags($_POST['phone']);
$message = strip_tags($_POST['message']);
// Send Message
$headers = GetHeaders();
$intro = "\"Thank you for contacting Company Name. We are very interested in assessing your situation and will be in touch as soon possible.\" <br />
<br/>
Best Regards,<br/>
<br/>
Company<br/>
";
mail($email, "RE: Contact Form Submission", $intro, $headers);
?>
感謝提前任何幫助。
什麼'process.php'的內容? – Julien
我在上面添加了它,但好像它甚至沒有達到process.php。當使用include(「process.php」);我可以讓所有的東西都可以工作,但我真的很想掌握爲什麼表單插件不工作。我也在使用jquery 1.8.0 – user1505573
在html'action ='contact.php''和ajax'url:'process.php''讓我感到困惑 – diEcho