Call to undefined function - Even though its in functions.php

Hello,

I have a function which is in Functions.php, and I’m trying to run this along with some code in a PHP script. The script runs when a form is submitted, and it takes the data inputted into the form, sanitizes it (which is what the function does) and inputs it into the Database.

The error occurs on line 4, which is:

[php]$title = protect($con, $_POST[‘title’]);[/php]

The error is referencing “protect” as it says it is undefined. The function in functions.php is:

[php]function Protect($con, $val)
{
$val = mysqli_real_escape_string ($con, $val);
return $val;
}[/php]

and the specific error that shows when the php script is ran is:

Fatal error: Call to undefined function protect() in C:-File Path-\add_listing.php on line 4

I have tried to google about this, however it keeps coming up with wordpress related issues which I’m not using. My setup is Xampp/Apache on Windows 7, with PHP, HTML, CSS and Javascript - I’m not using any frameworks.

Just for more information, I have called the add_listing.php in html by using the Action=“PHP File”. For example

[code]

[/code]

I however believe it has to do with the syntax, or the configuration of my Xampp install. Nothing of this nature happens with any other PHP aspects of my site, it’s just purely this.

I’m not sure what other information to include, if I have missed anything I do apologize and will provide what’s missing.

Thank you for your time!

The function is undefined.

Protect != protect

Sponsor our Newsletter | Privacy Policy | Terms of Service