0 Replies - 3010 Views - Last Post: 14 November 2012 - 03:28 PM

#1 CHAIK   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 14-November 12

Can't get my html form to work

Posted 14 November 2012 - 03:28 PM

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Casa de Salud Huichol</title>
<link href="CSS/style.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="Images/favicon.ico" type="image/x-icon" />

<div id="back">
  <div id="main_contacto">
    <div id="header">
      <div id="formulario">
        <form action="mail_contacto_prueba2.php" method="post" class="formulario_contacto" id="contacto">
          <table width="650" height="400" border="0" align="#">
              <td height="39" colspan="0"><label>
                  <input name="nombre" type="text" class="textbox_formulario" id="nombre" style="background-color: #00212f" size="50" maxlength="50" />
              <td height="36" colspan="#"><label>
                  <input name="email" type="text" class="textbox_formulario" style="background-color: #00212f" id="email" size="50" maxlength="50" />
              <td height="44" colspan="#"><label>
                  <input name="asunto" type="text" class="textbox_formulario" style="background-color: #00212f" id="asunto" size="50" maxlength="50" />
              <td height="60" colspan="#"><label>
                  <select name="recipient">
                    <option value="">Choose a recipient</option>
                    <option value="recipient_1">Sales</option>
                    <option value="recipient_2">Support</option>
                    <option value="recipient_3">Customer service</option>
              <td height="63" colspan="0"><label>
                  <textarea name="mensaje" type="text" class="textbox_formulario" style="background-color: #00212f" id="mensaje" cols="110" rows="10"></textarea>
              <td width="571">&nbsp;</td>
              <td width="83"><input type="submit" name="enviar" id="enviar" value="Enviar" /></td>
          <table width="200">
            <tr> </tr>
          <label> </label>
          <br />
      <div id="regresar_menu_contacto">
          <li><a href="index.html" class="regresar_menu_boton_contacto" title="Regresar al Menu">Regresar al menu</a></li>

This is My PHP

	$head = "From: ".$_POST['email']."\r\n";
	// Ahora creamos el cuerpo del mensaje
	$msg = "----------------------------- \n";
	$msg.= "         Contacto            \n";
	$msg.= "----------------------------- \n";
	$msg.= "NOMBRE:   ".$_POST['nombre']."\n";
	$msg.= "APELLIDO:    ".$_POST['apellido']."\n";
	$msg.= "DOMICILIO:    ".$_POST['domicilio']."\n";
	$msg.= "E-MAIL:    ".$_POST['email']."\n";
	$msg.= "CIUDAD:    ".$_POST['ciudad']."\n";
	$msg.= "C.P.:    ".$_POST['postal']."\n";
	$msg.= "HORA:     ".date("h:i:s a ")."\n";
	$msg.= "FECHA:    ".date("D, d M Y")."\n";
	$msg.= "----------------------------- \n\n";
	$msg.= "MENSAJE:    ".$_POST['mensaje']."\n";
	$msg.= "----------------------------- \n";
	$msg.= " Mensaje creado por cliente \n";
	// Finalmente enviamos el mensaje
	$recipients = array(

'recipient_1' => "[email protected]",
'recipient_2' => "[email protected]",
'recipient_3' => '[email protected]'


$my_email = $recipients[$_REQUEST['recipient']];

if (mail("[email protected]", "Contacto", $msg, $head)) {
		echo "Sus datos se enviaron correctamente.";
	} else {
		echo "Ha habido un error al enviar el formulario.";

Mod edit - Fixed tags.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1