Pero buscas alguien que te lo haga, o tienes alguna duda de sintaxis ?
Bueno de todos modos, hoy he montado uno, te lo pego ya de paso
Código PHP:
<?php
// get_magic_quotes_gpc() // nos informa si las comillas estan activadas en servidor
//stripslashes funcion para desactivar las barras /
if(get_magic_quotes_gpc()){
foreach($_POST as $a=>$b){
$_POST[$a] = stripslashes($b);
}
} // con esto, recorremos todos los POST, para desactivar las barras , sin tener que escribir todo
if(isset($_POST['Enviar'])){
if(mb_eregi('^[\\A-ZÁáÉéÍíÓóÚúÑñÇçÜüÀà\-_\']{3,10}$',$_POST['Nombre'])){
$nombreBien = true;
}else{
$nombreBien = false;
$nomError = "Escribe bien el nombre";
}
if(mb_eregi('^[A-ZÁáÉéÍíÓóÚúÑñÇçÜüÀà\-_0-9]{3,10}$',$_POST['Apellidos'])){
$apeBien = true;
}else{
$apeBien = false;
$apeError = "Escribe bien el nombre";
}
if(mb_eregi('^(9)[0-9]{8}$',$_POST['Telefono'])){
$telfBien = true;
}elseif(mb_eregi('^(6)[0-9]{8}$',$_POST['Telefono'])){
$telfBien = true;
}else{
$telfBien = false;
$telfError = "Escribe bien el nombre";
}
if(mb_eregi('^[0-9]{8}\-[A-Z]$',$_POST['Nif'])){
$dniBien = true;
}elseif(mb_eregi('^(X|Y){1}[0-9]{8}[A-Z]{1}$',$_POST['Nif'])){
$dniBien = true;
}elseif(mb_eregi('^(A|B|C){1}[0-9]{8}$',$_POST['Nif'])){
$dniBien = true;
}else{
$dniBien = false;
$dniError = "escribe bien el dni / cif / nie";
}
if(mb_strlen($_POST['Comentario']) >= 10){
$comenBien = true;
}else{
$comenBien = false;
$comenError = "Escribe mas texto";
}if($nombreBien && $dniBien && $telfBien && $apeBien && $comenBien){
$msg = "Su tabaco gracias!";
}else{
$msg = "Error fatal";
if(get_magic_quotes_gpc()){
$nombre = stripslashes($_POST['Nombre']);
$ape = stripslashes($_POST['Apellidos']);
$telf = stripslashes($_POST['Telefono']);
$nif = stripslashes($_POST['Nif']);
$comen = stripslashes($_POST['Comentario']);
if(get_magic_quotes_gpc()){
foreach($_POST as $a=>$b){
$_POST[$a] = stripslashes($b);
}
}
}
}
}
?>
<!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>Documento sin título</title>
</head>
<body>
<p> </p>
<form id="form" name="form" method="post" action="Ejercicio9.php">
<p><?php echo $msg; ?></p>
<p>
<label>Nombre
<input name="Nombre" type="text" id="Nombre" value="<?php echo $nombre; ?>" />
</label>
<?php echo $nomError; ?></p>
<p>
<label>Apellidos
<input name="Apellidos" type="text" id="Apellidos" value="<?php echo $ape; ?>" />
</label>
<?php echo $apeError; ?></p>
<p>
<label>Telefono
<input name="Telefono" type="text" id="Telefono" value="<?php echo $telf; ?>" />
</label>
<?php echo $telfError; ?></p>
<p>
<label>NIF
<input name="Nif" type="text" id="Nif" value="<?php echo $nif; ?>" />
</label>
<?php echo $dniError; ?></p>
<p>
<label>Comentario
<textarea name="Comentario" id="Comentario" cols="45" rows="5"><?php echo $comen; ?></textarea>
</label>
</p>
<p>
<label>
<input type="submit" name="Enviar" id="Enviar" value="Enviar" />
</label>
</p>
</form>
</body>
</html>