Ver Mensaje Individual
  #3 (permalink)  
Antiguo 29/03/2016, 15:30
Avatar de Hernand67890
Hernand67890
 
Fecha de Ingreso: febrero-2016
Ubicación: Cundinamarca
Mensajes: 15
Antigüedad: 8 años, 2 meses
Puntos: 0
Respuesta: formulario de contacto en php

Gracias por su respuesta oportuna, anexo el codigo correspondiente al archivo messaguecli.php.

Código Java:
Ver original
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4.     <meta http-equiv="content-type" content="text/html" />
  5.     <meta name="author" content="gencyolcu" />
  6.     <title>Contactar al cliente</title>
  7.     <link rel="stylesheet" href="buttons.css" type="text/css" media="screen" />
  8.     <style type="text/css">
  9.     <meta charset="utf-8">
  10.             @import url("style.css");
  11.     </style>
  12. </head>
  13. <body background="bg_top_img_3.jpg">
  14.     <img aling = top left src= "logo_inicial_3.png">
  15.     <?php
  16. session_start();
  17. ?>
  18. <form>
  19. <!--<body background="bgimage.jpg"> -->
  20. <table border="1" cellspacing="0">
  21. <TR>
  22. <TH>Fecha</TH>
  23. <TD><input   name="fecha"  value="<?php echo date("Y-m-d");?>"   READONLY /></TD>
  24. <TH>Usuario</TH>
  25. <TD><input  name="Usuario"  value="<?php echo $_SESSION['usuario'];?>"  READONLY /></TD>
  26. </table><br>
  27.  
  28. </form>
  29. </br>
  30. </br>
  31. </br>
  32. </br>
  33.  
  34.  
  35.  
  36. <h1>Contacto al cliente.</h1>
  37. <form name="frmContacto" method="post" action="sendbymail.php">
  38. <table width="500px">
  39. <table border="2" cellspacing="0">
  40. <tr>
  41. <td>
  42. <label for="first_name">Nombre: *</label>
  43. </td>
  44. <td>
  45. <input type="text" name="first_name" maxlength="50" size="25">
  46. </td>
  47. </tr>
  48. <tr>
  49. <td valign="top"">
  50. <label for="last_name">Apellido: *</label>
  51. </td>
  52. <td>
  53. <input type="text" name="last_name" maxlength="50" size="25">
  54. </td>
  55. </tr>
  56. <tr>
  57. <td>
  58. <label for="email">Dirección de E-mail: *</label>
  59. </td>
  60. <td>
  61. <input type="text" name="email" maxlength="80" size="35">
  62. </td>
  63. </tr>
  64. <tr>
  65. <td>
  66. <label for="telephone">Número de teléfono:</label>
  67. </td>
  68. <td>
  69. <input type="text" name="telephone" maxlength="25" size="15">
  70. </td>
  71. </tr>
  72. <tr>
  73. <td>
  74. <label for="comments">Comentarios: *</label>
  75. </td>
  76. <td>
  77. <textarea name="comments" maxlength="500" cols="30" rows="5"></textarea>
  78. </td>
  79. </tr>
  80. <tr>
  81. <td colspan="2" style="text-align:right">
  82. <input type="submit" class= "button blue" value="Enviar">
  83. </td>
  84. </tr>
  85. </table>
  86. </form>
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93. </div><br>
  94. <footer>
  95. <center>         <div class="wrapper">
  96.                    <section class="lower">
  97.                        <h4>
  98.                        <a rel="nofollow" href="http://www.templatemonster.com/" target="_blank">Website Template</a> <font color="black">Desarrollado por Rafael Hernando Riveros  <a rel="nofollow" href="http://estudios.unad.edu.co/tecnologia-en-desarrollo-de-software/plan-de-estudios/tecnologia-de-sistemas-plan-de-estudios-antiguo-2006" target="_blank">Tecnologia en Sistemas</a> <a rel="nofollow"   <a rel="nofollow" href="https://www.unad.edu.co" target="_blank">UNAD</a> <a rel="nofollow" href="http://centro.unad.edu.co/girardot" target="_blank">Cead Girardot ZCBC</a> Aplicacion web de gestion para soporte tecnico</font>
  99.                     <section class="lower">
  100.                        </h4>
  101. </body>
  102. </html>

imagen del error:



codigo del archivo senbymail.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>Validar mensaje</title>
  6. </head>
  7.  
  8. <body>
  9. </body>
  10. </html>
  11.  
  12. <?php
  13. if(isset($_POST['email'])) {
  14.  
  15. // Debes editar las próximas dos líneas de código de acuerdo con tus preferencias
  16. //$email_to = "[email protected]";
  17. //$email_subject = "Contacto desde el sitio web";
  18.  
  19. //$email_to = "[email protected]";
  20. $email_to ="[email protected]";
  21. $email_subject = "Contacto desde el sitio web de la Aplicacion ControlServiceOnline";
  22.  
  23. // Aquí se deberían validar los datos ingresados por el usuario
  24. if(!isset($_POST['first_name']) ||
  25. !isset($_POST['last_name']) ||
  26. !isset($_POST['email']) ||
  27. !isset($_POST['telephone']) ||
  28. !isset($_POST['comments'])) {
  29.  
  30. echo "<b>Ocurrió un error y el formulario no ha sido enviado. </b><br />";
  31. echo "Por favor, vuelva atrás y verifique la información ingresada<br />";
  32. die();
  33. }
  34.  
  35. $email_message = "Detalles del formulario de contacto:\n\n";
  36. $email_message .= "Nombre: " . $_POST['first_name'] . "\n";
  37. $email_message .= "Apellido: " . $_POST['last_name'] . "\n";
  38. $email_message .= "E-mail: " . $_POST['email'] . "\n";
  39. $email_message .= "Teléfono: " . $_POST['telephone'] . "\n";
  40. $email_message .= "Comentarios: " . $_POST['comments'] . "\n\n";
  41.  
  42.  
  43. // Ahora se envía el e-mail usando la función mail() de PHP
  44. $headers = 'From: '.$email_from."\r\n".     //esta es la linea 44
  45. 'Reply-To: '.$email_from."\r\n" .                  //esta es la linea 45
  46. 'X-Mailer: PHP/' . phpversion();
  47. @mail($email_to, $email_subject, $email_message, $headers);
  48.  
  49. echo "¡El formulario se ha enviado con éxito!";
  50. }
  51. ?>

Gracias