Bueno muchas gracias por todo
Nemutagk, aquí esta el código corregido por si alguien lo quiere utilizar, no se si sea la forma correcta de hacerlo y si alguien tiene una sugerencia para mejorarlo sera bien recibida.
Código PHP:
Ver original<?php
$username = $_POST['username'];
$email = $_POST['email'];
$pass = $_POST['pass'];
$repass = $_POST['repass'];
if($_POST['submit'] == "register") {
$error['number/letters'] = '<div style="color: red;">Please use only letters (a-z), and numbers.</div>';
} else {
$error['min/max_c'] = '<div style="color: red;">Please use between 6 and 18 characters.</div>';
}
} else {
$error['username_null'] = '<div style="color: red;">You can\'t leave this empty.</div>';
}
}
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_null'] = '<div style="color: red;">You can\'t leave this empty.</div>';
}
$error['pass_min/max'] = '<div style="color: red;">Please use between 6 and 18 characters.</div>';
}
} else {
$error['pass_null'] = '<div style="color: red;">You can\'t leave this empty.</div>';
}
$error['repass_null'] = '<div style="color: red;">You can\'t leave this empty.</div>';
} else {
if($pass != $repass) {
$error['pass'] = '<div style="color: red;">These passwords don\'t match.</div>';
}
}
echo "no hay errores :)";
}
}
?>
Saludos!