Cita:
Iniciado por Nemutagk
eso es cuestión de tus validaciones de los campos, no se si te has dado cuenta, pero todos los campos solo son validados si no están vacíos! por lo tanto si llegan vacíos no se validan, en tus if debes agregar un else donde agregas un error indicando que están vacíos...
Código PHP:
Ver original if(!preg_match("/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)*\.([a-zA-Z]{2,6})/", $email)) { $error['email'] = '<div style="color: red;">Enter your correct email address.</div>';
}
}else {
$error['email'] = '<div style="color: red;">Is necessary to indicate an email address.</div>';
}
Se me olvido agregar la otra parte de mi formulario que se procesa en la misma pagina
Código HTML:
Ver original<form method="post" action="register.php" enctype="multipart/form-data">
<h2>Choose a username:
</h2> <input type="text" class="inputtext" autocomplete="off" name="username"> <?php if(empty($_POST['username']) && isset($_POST['username'])) { echo '<div style="color: red;">You can\'t leave this empty.
</div>'; } ?>
<?=$error['user_exist']?>
<?=$error['min/max_c']?>
<?=$error['number/letters']?>
<h2>Your current email address:
</h2> <input type="text" class="inputtext" autocomplete="off" name="email"> <?php if(empty($_POST['email']) && isset($_POST['email'])) { echo '<div style="color: red;">You can\'t leave this empty.
</div>'; } ?>
<?=$error['email']?>
<?=$error['email_exist']?>
<h2>Choose a password:
</h2> <input type="password" class="inputtext" name="pass"> <?php if(empty($_POST['pass']) && isset($_POST['repass'])) { echo '<div style="color: red;">You can\'t leave this empty.
</div>'; } ?>
<?=$error['pass_min/max']?>
<h2>Re-enter password:
</h2> <input type="password" class="inputtext" name="repass"> <?php if(empty($_POST['repass']) && isset($_POST['repass'])) { echo '<div style="color: red;">You can\'t leave this empty.
</div>'; } ?>
<?=$error['pass']?>
<div class="panel_upload"> <input id="b-submit" type="submit" name="submit" value="register">