SALUDOS HE PROBADO EL CODIGO CON LA MODIFICACION QUE ME DIERON PERO NO SE PORQUE AUN NO ME VALIDA
QUE HAGO MAL?
<? if(!$HTTP_POST_VARS){ ?>
<FORM name="form1" action="<? $PHP_SELF; ?>" method="post">
<table summary="" width="442" border="0" align="center" cellpadding="0" cellspacing="3" class="wholesale">
<tr>
<td width="140" align="right" class="XBackGrey"><span class="letrastitulos">Nombre</span>:</td>
<td width="287"><INPUT name=name class="inputwholesale" id="name">
</td>
</tr>
<tr>
<td align="right" class="letrastitulos">E-mail:</td>
<td><INPUT name=email class="inputwholesale" id="email" size="35">
</td>
</tr>
<tr>
<td align="right" class="letrastitulos">Telefono:</td>
<td><INPUT name=phone class="inputwholesale" id="phone" size="35"></td>
</tr>
<tr>
<td align="right" class="letrastitulos">Asunto:</td>
<td><INPUT name=subject class="inputwholesale" id="subject" size="25"></td>
</tr>
<tr>
<td align="right" class="letrastitulos">Comentarios:</td>
<td><textarea style="background-color: #FFFFFF; border-style: inset; border-color: #B5DBEE; border: 1 inset #B5DBEE;" name=comments rows=4 cols=30></textarea></td>
</tr>
<tr>
<td align="right"> </td>
<td><INPUT name=submit type=button class="buttonwholesale" style="CURSOR: hand;" value="Send" onclick="validar('form1')">
<INPUT name=reset type=reset class="buttonwholesale" style="CURSOR: hand;" value=Reset></td>
</tr>
</table>
</form>
<? }
else{
$contactname = "PRUEBA";
$contactemail = "
[email protected]";
$message = "<HTML><BODY>";
$message.= "Name: <b>".$name."</b><br>" ;
$message.= "E-mail: <b>".$email."</b><br>" ;
$message.= "Phone Number: <b>".$phone."</b><br>" ;
$message.= "Subject: <b>".$subject."</b><br>" ;
$comentario = str_replace("\r\n","<br>",$comments);
$message.= "Comment: <b><br>".$comentario."</b><br>" ;
$message .= "</BODY></HTML>";
$subject2 = "Prueba - Contacto";
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "From: ". $name ." <". $email .">\n";
//$headers .= "To: Contactenos <".$contactemail.">\n";
mail($contactemail, $subject2, $message, $headers);
?>
<script language="JavaScript">
location.href='contacto2.php';
</script>
<script language="JavaScript">
function Validar(form1){
if (form1.name.value == "")
{ alert("Please enter your name"); form1.name.focus(); return; }
if (form1.email.value == "")
{ alert("Please enter your email"); form1.email.focus(); return; }else{
var s = form1.email.value;
var filter=/^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
if (!filter.test(s))
{alert("Please enter a valid email address");
form1.email.focus();
return;}
}
if (form1.phone.value == "")
{ alert("Please enter your state"); form1.phone.focus(); return; }
if (form1.subject.value == "")
{ alert("Please enter your age"); form1.subject.focus(); return; }
if (form1.comments.value == "")
{ alert("Please enter your message"); form1.comments.focus(); return; }
form1.submit();
}
</script>
<? }
?>