I'm trying to do a really basic bit of form validation. I'm using a friends server as it's his site. I've tested this on mine 1and1 in the UK. It works fine. Tried it on his, fasthosts and it fails.
The crux of the problem seems to be that I am setting a variable inside an if statement.
If I then try to use the variable outside the if I get an error undefined variable. I have even tried to define the variable as a dummy value before the if statement but I get the same error.
My code looks like this
Code: Select all
if ($_POST['name']<""){
$errors = "1";
$name_error = "You did not enter your name!";
}
if ($errors == "1") {
echo "Errors";
}Code: Select all
Notice: Undefined variable: errors in E:\domains\n\nicholaskirtonphotography.co.uk\user\htdocs\contact_process.php on line 35Can anyone help as I am about to move the site to a different server.
P.s. Fasthosts seem to think this is fine.