Ver Mensaje Individual
  #2 (permalink)  
Antiguo 05/05/2011, 07:18
Avatar de bUllan9ebrio
bUllan9ebrio
 
Fecha de Ingreso: enero-2011
Ubicación: Chile
Mensajes: 1.128
Antigüedad: 13 años, 3 meses
Puntos: 128
Respuesta: PHP para un select name

Prueba con esto :

Código HTML:
Ver original
  1. <form id="freeform" name="a" method="post" action="enviarmail.php" >
  2.     <label id="freeform_name_label" for="name">Nombre</label>
  3.     <input type="text" id="freeform_name" name="name" />
  4.     <label id="freeform_email_label" for="email">Email</label>
  5.     <input type="text" id="freeform_email" name="email" />
  6.     <label id="freeform_subject_label" for="subject">Asunto</label>
  7.     <input type="text" id="freeform_subject" name="subject" />
  8.     <label id="freeform_topic_label" for="topic[]">Tema</label>
  9.     <select name="topic" id="freeform_topic" />
  10.         <option value="Oferta de producto">Oferta de producto / negocio</option>
  11.         <option value="Propuesta de ideas">Propuesta de ideas</option>
  12.         <option value="Pedido">Pedido</option>
  13.         <option value="Informacion">Informaci&oacute;n</option>
  14.         <option value="Solicitud de Newsletters">Solicitud de Newsletters</option>
  15.         <option value="Otros">Otros</option>
  16.     </select>
  17.     <label id="freeform_question_label" for="question">Cuesti&oacute;n</label>
  18.     <textarea name="question" id="freeform_question"></textarea>
  19.     <input type="submit" id="submit" name="submit" class="button large" value="Enviar Mensaje &gt;" />
  20. </form>


Código PHP:
Ver original
  1. <?
  2. $name = $_POST['name'];
  3. $email = $_POST['email'];
  4. $asunto = $_POST['subject'];
  5. $topic = $_POST['topic'];
  6. $question=$_POST['question'] ;
  7.  
  8. $header = 'From: ' . $email . " \r\n";
  9. $header .= "X-Mailer: PHP/" . phpversion() . " \r\n";
  10. $header .= "Mime-Version: 1.0 \r\n";
  11. $header .= "Content-Type: text/plain";
  12. $asunto = 'Correo desde la web';
  13.  
  14. $mensaje = "Nombre: " . $name. " \r\n";
  15. $mensaje .= "E-mail: " . $email . " \r\n";
  16. $mensaje .= "Motivo: " . $topic . " \r\n";
  17. $mensaje .= "Cuestion: " .$question. " \r\n";
  18.  
  19.  
  20. mail($para, $asunto, utf8_decode($mensaje), $header, $topic);
  21.  
  22. echo 'Su solicitud ha sido enviada con éxito. En breve recibirá noticias de XXX atendiendo su petición. Muchas gracias.'
  23.  
  24. ?>
__________________
Si no vivimos como pensamos, pronto empezaremos a pensar como vivimos.
Más vale un Gracias sincero, que un número que aumente "popularidad" ¬¬°

Universidad de chile, campeón