Ver Mensaje Individual
  #13 (permalink)  
Antiguo 31/08/2011, 19:18
Avatar de hasdpk
hasdpk
 
Fecha de Ingreso: agosto-2011
Ubicación: $spain->city( 'Arucas' );
Mensajes: 1.800
Antigüedad: 12 años, 8 meses
Puntos: 297
Respuesta: Problema con formulario de contacto

Yo sólo te voy a dar los pasos a seguir, ahora tu tienes que crear el resto:

Código PHP:
Ver original
  1. <?php
  2.  
  3.     if ($_POST) {
  4.  
  5.         $to = '[email protected]';
  6.         $subjet = 'asunto';
  7.         $txt = $_POST['campo'];
  8.  
  9.         if (mail($to, $subjet, $txt)) {
  10.        
  11.             $alerta = "Tu mensaje ha sido enviado. ¡Gracias!";
  12.            
  13.         } else {
  14.        
  15.             $alerta = "Hay un error. Por favor, inténtelo de nuevo más tarde.";
  16.        
  17.         }
  18.  
  19.     }
  20.  
  21. ?>
  22.  
  23. <html>
  24.  
  25.     <head> ... </head>
  26.  
  27.     <body>
  28.    
  29.         <?php echo $alerta; ?>
  30.  
  31.         <form method="POST">
  32.  
  33.             <input type="text" name="campo">
  34.             <input type="submit" value="enviar">
  35.  
  36.         </form>
  37.  
  38.     </body>
  39.  
  40. </html>

Si quieres que te lo explique paso a paso, no tengo problema.