Hi everyone!
I am very new at this and maybe I'm not posting this in the right area, but please bare with me. I'm trying to set up a form that while email me the info input by the visitor. However I always get that the connection was reset by the server and nothing happens. Could any please have a look and maybe tell me what I'm doing wrong? I've tried a million things!! I don't even know where to put the files Also, I would like to add a validation that will print a Java alert if the email is bad, if there is no name (nombre) and if the message (comments) are too short.
It might be worth noting that I'm just on the web hosting server and don't have any program installed on my pc as its a windows laptop.
I really appreciate it!! :D
-------------------------------------------------------------------------------------------------------------
I am very new at this and maybe I'm not posting this in the right area, but please bare with me. I'm trying to set up a form that while email me the info input by the visitor. However I always get that the connection was reset by the server and nothing happens. Could any please have a look and maybe tell me what I'm doing wrong? I've tried a million things!! I don't even know where to put the files Also, I would like to add a validation that will print a Java alert if the email is bad, if there is no name (nombre) and if the message (comments) are too short.
It might be worth noting that I'm just on the web hosting server and don't have any program installed on my pc as its a windows laptop.
I really appreciate it!! :D
Code:
<?php
$field_nombre = $_POST["nombre"];
$field_apellido = $_POST["apellido"];
$field_email = $_POST["email"];
$field_tipo = $_POST["tipo"];
$field_comments = $_POST["comments"];
$mail_to = "[email protected]";
$subject = "Contacto Web ".$field_nombre .$field_apellido;
$body_message = "From: ".$field_name .$field_apellido."\n";
$body_message .= "Tipo: ".$field_tipo."\n";
$body_message .= "E-mail: ".$field_email."\n";
$body_message .= "Message: ".$field_message;
$headers = "From: ".$field_email."\r\n";
$headers .= "Reply-To: ".$field_email."\r\n";
$email_status = mail($mail_to, $subject, $body_message, $headers);
if ($email_status) { ?>
<script language="javascript" type="text/javascript">
alert("Gracias por contactarnos. Un representante se contactara con usted a la brevedad");
window.location = "Contact.html";
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert("Error en el mensaje. Por favor reintente o comuniquese con my @ email.com");
window.location = "Contact.html";
</script>
<?php
}
?>
Code:
<!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=UTF-8" />
<title>Main</title>
<style type="text/css">
<!--
body {
margin_top: 40px
margin-left: 30px;
position: relative;
height: auto;
width: 700px;
font-family: "Eras Light ITC", "Eras Medium ITC", "Eras Bold ITC", "Eras Demi ITC";
font-size: 18px;
left: 40px;
top: 30px;
}
.Style1 {font-size: 18px; font-weight: bold; color: #63B040;}
a:link {
color: #63B040;
}
a:visited {
color: #63B040;
}
a:hover {
color: #63B040;
}
a:active {
color: #63B040;
font-weight: bold;
}
-->
</style></head>
<body>
<form name="contactform" method="post" action="enviarformulario.php">
<p align="Left" style="font-size: 24px; color: #68BD45; font-weight: bold;"><img src="img/GreenArrow.jpg"/> Contacto</p>
<p>
Para unirte a la revolución LED basta con que nos envíes un correo y podremos empezar a diseñar una solución especial para tí y tus necesidades.</p>
<table width="665">
<tr>
<td valign="top">
<label for="nombre">Nombre *</label>
</td>
<td valign="top">
<input type="text" name="nombre" maxlength="50" size="15"></input>
</td>
</tr>
<tr>
<td valign="top">
<label for="apellido">Apellido *</label>
</td>
<td valign="top">
<input type="text" name="apellido" maxlength="50" size="15"></input>
</td>
</tr>
<tr>
<td valign="top">
<label for="email">Email *</label>
</td>
<td valign="top">
<input type="text" name="email" maxlength="80" size="30"></input>
</td>
</tr>
<tr>
<td valign="top">
<label for="tipo">Tipo *</label>
</td>
<td valign="top"><select name="tipo" title="Tipo" dir="ltr">
<option value="Cliente">Cliente</option>
<option value="Proveedor">Proveedor</option>
<option value="Otro">Otro</option>
<option selected="selected">Elige una opción...</option>
</select></td>
</tr>
<tr>
<td valign="top">
<label for="comments">Mensaje *</label>
</td>
<td valign="top">
<textarea name="comments" maxlength="1000" cols="50" rows="10"></textarea>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center">
<input type="submit" value="Enviar"></input>
</td>
</tr>
<tr>
<td height="53" colspan="2" align="center" style="font-size: 16px; color: #68BD45; font-weight: lighter;"></br>Cualquier información entregada en esta página será tratada con la máxima confidencialidad. No le pasaremos tu correo electrónico a nadie... Nunca.</td>
</tr>
</table>
</form>
</body>
</html>