Holas bueno quisiera validar mi formulario con php pero la verdad no se como hacerlo pero capto algo de como hacerlo , alguien por favor podria explicarme
<? if(!$HTTP_POST_VARS){ ?>
<FORM name="form1" onSubmit="Validar(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>
<? }
?>