i want to know the error in this code
<?php
$firstname = $_POST ['firstname'];
$lastname = $_POST ['lastname'];
$pass1 = md5($_POST['pass1']);
$pass2 = md5($_POST['pass2']);
$email = $_POST ['email'];
// filters name
function filtername ($field) {
$field = filter_var(trim($field), FILTER_SANITIZE_STRING);
if (filter_var($field, FILTER_VALIDATE_REGEXP, array ("options"=> array ("regexp"=>"/^[Z-zA-Z\s]+/")))) {
return $field;
} else {
return FALSE;
}
}
// filters pass1
function filterpass ($field) {
$field = array('min_range' => 8,);
if ($field < $min_range) {
echo "password is mine range";
return FALSE;
} else {
return $field;
}
}
// filters email
function filteremail ($field) {
$field = filter_var(trim($field), FILTER_SANITIZE_EMAIL);
if (filter_var($field, FILTER_VALIDATE_EMAIL)) {
return $field;
} else {
return FALSE;
}
}
/*
* empty valedate input
* fistname
* lastname
* pass1
* pass2
* email
*/
$Errname = $Errpassword = $Erremail = "";
$name = $password = $Email ="";
if ($_SERVER ["REQUEST_METHOD"] == "POST") {
// empty name 1
if (empty ($firstname)) {
echo $Errname = "sorry the firstname is empty"."<br />";
} else {
$name = filtername($firstname);
if ($name == FALSE) {
echo $Errname = "OOPS the valedate is false"."<br />";
}
}
// empty name 2
if (empty ($lastname)) {
echo $Errname = "sorry the last name is emty"."<br />";
} else {
$name = filtername($lastname);
if ($name == FALSE) {
echo $Errname = "OPPS the valdeate last name is false"."<br />";
}
}
// empty pass 1
if (empty ($pass1)) {
echo "sorry the password is empty"."<br />";
}
// empty pass 2
if (empty ($pass2)) {
echo "sorry the password is empty"."<br />";
}
// empty email
if (empty ($email)) {
echo $Erremail = "sorry the Email is empty"."<br />";
} else {
$Email = filteremail($email);
if ($Email == FALSE) {
echo $Erremail = "OOPS the valseate email is false"."<br />";
}
}
// check pass1 & pass2
if ($pass1 !== $pass2) {
echo "sorry the pass1 != pass2 ";
}
}
?>