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

#1 CHAIK  Icon 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">
<head>
<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" />
</head>

<body>
<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="#">
            <tr>
              <td height="39" colspan="0"><label>
                  <input name="nombre" type="text" class="textbox_formulario" id="nombre" style="background-color: #00212f" size="50" maxlength="50" />
                </label></td>
            </tr>
            <tr>
              <td height="36" colspan="#"><label>
                  <input name="email" type="text" class="textbox_formulario" style="background-color: #00212f" id="email" size="50" maxlength="50" />
                </label></td>
            </tr>
            <tr>
              <td height="44" colspan="#"><label>
                  <input name="asunto" type="text" class="textbox_formulario" style="background-color: #00212f" id="asunto" size="50" maxlength="50" />
                </label></td>
            </tr>
            <tr>
              <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>
                  </select>
                </label></td>
            </tr>
            
              <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>
                </label></td>
            </tr>
            <tr>
              <td width="571">&nbsp;</td>
              <td width="83"><input type="submit" name="enviar" id="enviar" value="Enviar" /></td>
            </tr>
          </table>
          <table width="200">
            <tr> </tr>
          </table>
          <label> </label>
          <br />
        </form>
      </div>
      <div id="regresar_menu_contacto">
        <ul>
          <li><a href="index.html" class="regresar_menu_boton_contacto" title="Regresar al Menu">Regresar al menu</a></li>
        </ul>
      </div>
    </div>
  </div>
</div>
</body>
</html>



This is My PHP


<?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' => "chaiker1@hotmail.com",
'recipient_2' => "contacto.chaik@gmail.com",
'recipient_3' => 'customerservices@example.com'

);

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


	
if (mail("chaiker1@hotmail.com", "Contacto", $msg, $head)) {
		echo "Sus datos se enviaron correctamente.";
	} else {
		echo "Ha habido un error al enviar el formulario.";
	}
	
	mail($my_email,$subject,$message,$headers);
	
?>



Mod edit - Fixed tags.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1