El problema es que una vez enviado el formulario no se borra la información y si actualizo la página en el navegador se vuelve a enviar, con lo que me llegan dos emails en vez de uno. La verdad es que he probado de todo y estoy un poco desesperado. A ver si me podeis echar una mano. Ahi va el codigo.
Código:
input { background: #D3D3D3; border: 1px solid #851111; margin-right: 5px; } </style> </head> <body> <div id="Base"> <div id="Titulo"><a href="Index.html" target="_self"><img src="Imagenes/TITULO.GIF" width="555" height="79" border="0" /></a></div> <div id="Presentacion"> <div id="Contenido1"> <form name="consulta" id="consulta" action="?" method="post"> <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="3" WIDTH="90%"> <TR><TD width="16%"><DIV align="right"><B>Nombre*:</B></DIV></TD><TD width="84%"> <INPUT type="text" name="name" size="40"></TD></TR><TR><TD> <TR><TD width="16%"><DIV align="right"><B>Apellidos*:</B></DIV></TD><TD width="84%"> <INPUT type="text" name="apellidos" size="40"></TD></TR><TR><TD> <TR><TD width="16%"><DIV align="right"><B>Dirección*:</B></DIV></TD><TD width="84%"> <INPUT type="text" name="direccion" size="40"></TD></TR><TR><TD> <TR><TD width="16%"><DIV align="right"><B>Teléfono:</B></DIV></TD><TD width="84%"> <INPUT type="text" name="telefono" size="40"></TD></TR><TR><TD> <DIV align="right"><B>Email*:</B></DIV></TD><TD> <INPUT type="text" name="email" size="40"></TD></TR><TR><TD> <DIV align="right"><B>Consulta*:</B></DIV></TD><TD> <TEXTAREA name="comment" cols="50" wrap="virtual" rows="6"></TEXTAREA></TD></TR><TR><TD> </TD><TD> <INPUT type="submit" name="submit" value="Submit"> <INPUT type="reset" name="reset" value="Reset"></TD></TR></TABLE></FORM> <?php ///////Configuración///// $mail_destinatario = '[email protected]'; ///////Fin configuración// if (isset ($_POST['submit'])) { if($_POST['name'] == "" || $_POST['apellidos'] == "" || $_POST['email'] == "" || $_POST['comment'] == ""){ die("Debe completar los campos con *"); } $headers .= "From: ".$_POST['email']; if ( mail ($mail_destinatario, $_POST['asunto'], "Nombre: ".$_POST['name']."\n Apellidos: ".$_POST['apellidos']."\n Dirección: ".$_POST['direccion']."\n Teléfono: ".$_POST['telefono']."\n Mensaje: ".stripcslashes ($_POST['comment']), $headers )) { echo 'Su mensaje ha sido enviado correctamente.'; unset($_POST['name']); } else echo ' Error. Por favor, inténtelo de nuevo mas tarde. '; } ?> </div> </div> <div id="Menu"> <ul id="MenuBar1" class="MenuBarHorizontal"> <li><a href="The School.html" target="_self">Who we are</a> </li> <li><a href="#" class="MenuBarItemSubmenu">Courses</a> <ul> <li><a href="Courses kids.html" target="_self">Kids and teens</a></li> <li><a href="Personalized.html" target="_self">Private classes</a></li> </ul> </li> <li><a href="#">Where we are</a></li> <li><a href="#">Contact</a></li> </ul> </div> <div id="Follow"><img src="Imagenes/follow us.GIF" width="70" height="16" /></div> <div id="Facebook"><a href="https://www.facebook.com/profile.php?id=100003059865271&sk=wall" target="_blank"><img src="Imagenes/facebook.GIF" width="30" height="30" border="0" /></a></div> <div id="En"><img src="Imagenes/Union Jack3bn.JPG" width="32" height="21" border="0" /></div> <div id="Es"><a href="Form_es.html" target="_self"><img src="Imagenes/Espana3.JPG" width="32" height="21" border="0" /></a></div> <div id="fondom"></div> </div> <script type="text/javascript"> var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"}); </script> </body> </html>