please what is wrong with this coding? am getting this error "Fatal error: Uncaught Error: Call to undefined function test_input() in C:\xampp\htdocs\Signup\www\index.php:30 Stack trace: #0 {main} thrown inC:\xampp\htdocs\Signup\www\index.phpon line30"
if(empty($_POST["name"])) {
$nameErr = "Name is required";
} else {
$name = test_input($_POST["name"]);
// check if name only contains letters and white space
if (!preg_match("/^[a-zA-Z]*$/",$name)){
$nameErr = "Only letters and white space allowed";
}
}
}
if(empty($_POST["email"])) {
$emailErr = "Email is required";
} else {
$email = test_input($_POST["email"]);
// check if e-mail address is well formed
if(!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$emailErr = "invalid email format";
}
}
if(empty($_POST["website"])) {
$website = "";
} else {
$website = test_input($_POST["website"]);
// check if URL address syntax is valid (this regular expression also allows dashes in the URL)
if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$website)) {
$websiteErr = "invalid URL";
}
}
PHP Contact Form Validation
in PHP
Posted