I have the following problems in the form I put together:
- The form is not sent to the email.
- After clicking the submit, pressing to reload the page, gives the conflict of "Confirm form resubmission".
Here is the Code:
<div class="form-dicas">
<div class="sombra"></div>
<div class="wrp-dicas clearfix">
<div id="dicas" class="dicas">
<img class="botao-fechar-x" src="images/botao-x.png">
<?php
if (isset($_POST['submit'])) {
unset($_POST['submit']);
$name = $_POST['name'];
$email = $_POST['email'];
$facebook = $_POST['facebook'];
$twitter = $_POST['twitter'];
$msg = $_POST['msg'];
$headers = "From: ".$email."\r\n";
$headers .= "MIME-Version: 1.0";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$subject = "Formulário de - ".$name;
$corpo = "Nome: " . $name . "\n";
$corpo .= "Email: " . $email . "\n";
$corpo .= "Facebook: " . $facebook . "\n";
$corpo .= "twitter: " . $twitter . "\n";
$corpo .= "Mensagem: " . $msg . "\n";
$email_to = '[email protected]';
mail($email_to, $subject, $corpo, $headers);
}
?>
<form action="" method="post">
<ul>
<li class="name">
<label for="name">Nome:</label>
<input required id="name" name="name" type="text" />
</li>
<li class="facebook">
<label for="facebook">Facebook (opcional):</label>
<input id="facebook" name="facebook" type="text" />
</li>
<li class="twitter">
<label for="twitter">Twitter (opcional):</label>
<input id="twitter" name="twitter" type="text" />
</li>
<li class="email">
<label for="email">E-mail:</label>
<input required id="email" name="email" type="text" />
</li>
<li class="msg">
<label for="msg">Mensagem:</label>
<textarea required id="msg" name="msg" type="text"></textarea>
</li>
<li class="submit">
<input id="send_form" type="submit" name="submit" value="Enviar" />
</li>
</ul>
</form>
</div><!-- div wrp-dicas -->
</div><!-- div sombra -->
</div><!-- div form-dicas -->
There is also a small jquery snippet, which I believe to be irrelevant, but here it is:
<script type="text/javascript">
var $j = jQuery.noConflict();
$j(document).ready(function() {
$j(".clique-aqui").click(function() {
$j(".form-dicas").fadeIn('slow');
});
$j(".botao-fechar-x").click(function() {
$j(".form-dicas").fadeOut("slow");
});
$j(document).bind('keydown', function(e) {
if (e.which == 27) {
$j(".form-dicas").fadeOut("slow");
}
});
});
</script>
I'm using xampp
to test this form, could you help me with what I did wrong?
Thanks!