當我提交使用此代碼表單提交 - 不刷新/隱藏股利後提交
PHP
if(empty($errors))
{
$to = $myemail;
$email_subject = "Contact form submission: $name";
$email_body = "You have received a new message. ".
" Here are the details:\n Name: $name \n Email: $email_address \n Message \n $message";
$headers = "From: $myemail\n";
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
header('Location: index.html');
}
我希望它做的是重定向我回到同一頁的形式留不清爽在同一頁上,然後隱藏在div ..
HTML
<div class="footer">
<div id="containerfooter">
<form method="POST" name="contactform" action="contact-form-handler.php" class="NewsLetter" class="NL__field NL__email">
<p>
<label for='name'>Your Name:</label> <br>
<input type="text" name="name" class="NL__field NL__email">
</p>
<p>
<label for='email'>Email Address:</label> <br>
<input type="text" name="email"> <br>
</p>
<p>
<label for='message'>Message:</label> <br>
<input type="text" name="message">
</p>
<input type="submit" value="Submit"><br>
</form>
</div>
</div>
種
JQuery的
$('form').submit(function(){
$('#containerfooter').hide();
});
你需要使用AJAX。 https://learn.jquery.com/ajax/ – chris85