Ver Mensaje Individual
  #3 (permalink)  
Antiguo 12/10/2012, 12:41
dcenteno1
 
Fecha de Ingreso: abril-2009
Mensajes: 5
Antigüedad: 15 años
Puntos: 0
Respuesta: formulario a varios correos con checkbox

gracias amigo, los 2 son php, aqui estoy montando los 2 codigos...

contactalo.php

Código PHP:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>CONTACTENOS</title>
  6.  
  7. </head>
  8. <body>
  9. <form id="contacto" name="contacto" method="post" action="kp-prueba.php">
  10. <center><table width="100%" height="100%" border="0">
  11. <tr>
  12. <td width="888" height="248"><CENTER>
  13. <p>&nbsp;</p>
  14. <p>&nbsp;</p>
  15. <table width="500" height="222" border="0" align="center" cellpadding="0" cellspacing="0" style="background-color:transparent">
  16. <tr>
  17. <td colspan="3" align="left"><strong class="Estilo9"><em><font style="font-size:20px">Consultas e Inquietudes:</font></em></strong></td>
  18. </tr>
  19.  
  20. <tr>
  21. <td width="18" height="32">&nbsp;</td>
  22. <td width="119"><em><font style="font-size:16px">Nombre:</font></em><br>
  23. &nbsp;</td>
  24. <td width="363" align="left"><label><input type="text" name="nombre" id="nombre" maxlength="30"/></label><br>
  25. &nbsp;</td>
  26. </tr>
  27. <tr>
  28. <td>&nbsp;</td>
  29. <td><em><font style="font-size:16px">Apellido:</font></em><br>
  30. &nbsp;</td>
  31. <td align="left"><label><input type="text" name="apellido" id="apellido" maxlength="30"/></label><br>
  32. &nbsp;</td>
  33. </tr>
  34. <tr>
  35. <td>&nbsp;</td>
  36. <td><em><font style="font-size:16px">Teléfono:</font></em><br>
  37. &nbsp;</td>
  38. <td align="left"><label><input type="text" name="tlf" id="tlf" maxlength="15"/></label><br>
  39. &nbsp;</td>
  40. </tr>
  41. <tr>
  42. <td>&nbsp;</td>
  43. <td><em><font style="font-size:16px">E-mail:</font></em><br>
  44. &nbsp;</td>
  45. <td align="left"><label><input type="text" name="mail" id="mail"/></label><br>
  46. &nbsp;</td>
  47. </tr>
  48. </table>
  49. <input type="checkbox" name="cor1" /> correo1<br>
  50. <input type="checkbox" name="cor2" /> correo2<br>
  51. <input type="checkbox" name="cor3" /> correo3<br>
  52. <p>&nbsp;</p>
  53. <table width="500" height="159" border="0" align="center" cellpadding="0" cellspacing="0" style="background-color:transparent">
  54. <tr>
  55. <td align="left"><strong class="Estilo9"><em><font style="font-size:20px">Déjenos un Mensaje:</font></em></strong></td>
  56. </tr>
  57. <tr>
  58. <td align="center"><p>
  59. <label><textarea name="mensaje" id="mensaje"></textarea></label>
  60. </p></td>
  61. </tr>
  62. <tr>
  63. <td align="center"><input type="submit" name="OK" value="Enviar" onclick="alert('Su mensaje fue enviado Satisfactoriamente...')"/></td>
  64. </tr>
  65. </table>
  66. <p>&nbsp;</p>
  67. </CENTER>
  68. </td>
  69. </tr>
  70. </table></center>
  71. </form>
  72. </body>
  73. </html>


kp-prueba.php

Código PHP:
Ver original
  1. <?php
  2.  
  3. $nombre = $_POST['nombre'];
  4. $apellido = $_POST['apellido'];
  5. $tlf = $_POST['tlf'];
  6. $mail = $_POST['mail'];
  7. $cor1 = $_POST['correo1'];
  8. $cor2 = $_POST['correo2'];
  9. $cor3 = $_POST['correo3'];
  10.  
  11. $header = 'From: ' . $mail . " \r\n";
  12. $header .= "X-Mailer: PHP/" . phpversion() . " \r\n";
  13. $header .= "Mime-Version: 1.0 \r\n";
  14. $header .= "Content-Type: text/plain";
  15.  
  16. $mensaje .= "Este mensaje fue enviado por: \r\n\n";
  17. $mensaje .= "Nombre: " . $nombre . " \r\n";
  18. $mensaje .= "Apellido: " . $apellido . " \r\n";
  19. $mensaje .= "Telefono: " . $tlf . " \r\n";
  20. $mensaje .= "Su e-mail es: " . $mail . " \r\n";
  21. $mensaje .= "Mensaje: " . $_POST['mensaje'] . " \r\n";
  22. $mensaje .= "Enviado el: " . date('d/m/Y', time());
  23.  
  24. if ($OK == "Enviar") {
  25.  
  26. if ( $cor1 == "on" ){ $para = '[email protected]'; $asunto = 'Consulta'; };
  27.  
  28. if ( $cor2 == "on" ){ $para = '[email protected]'; $asunto = 'Consulta'; };
  29.  
  30. if ( $cor3 == "on" ){ $para = '[email protected]'; $asunto = 'Consulta'; };
  31.  
  32. };
  33.  
  34.  
  35. mail($para, $asunto, utf8_decode($mensaje), $header);
  36. echo "<script>document.location.href='contactalo.ph p';</script>\n";
  37.  
  38. ?>