First of all, yes I have seen familiar questions but I have no idea about PHP and my code was mostly copy and pasted by a tutorial. I was hoping for a more of a direct answer towards me then trying to figure it on a previously answered question.
I get this error when i go to my contact page " Fatal error: Call to undefined function test_input() in /home/precisioncne/public_html/form_process.php on line 14". My contact page has html and php. Contact page code: https://pastebin.com/7yAx59Bv
This is my form_process page which is receiving the error:
<?php
ini_set('display_errors', 1);
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$number = $_POST['number'];
$message = $_POST['message'];
$to = "email@email.com";
$subject = "New Email - Contact Form - Website";
$fname = test_input($_POST["fname"]);
if (!preg_match("/^[a-zA-Z ]*$/",$fname)) {
$nameErr = "Only letters and white space allowed";
}
$lname = test_input($_POST["lname"]);
if (!preg_match("/^[a-zA-Z ]*$/",$lname)) {
$nameErr = "Only letters and white space allowed";
}
$email = test_input($_POST["email"]);
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$emailErr = "Invalid email format";
}
mail ($to, $subject, $message, "From: " . $fname . $lname . $number);
echo "Your message has been sent!";
?>
Any help would be great thanks.