Hi,
I'm trying to execute a function, and it it works it will open another page, and if not it will return an error message.
So I have: -
include($DOCUMENT_ROOT.'/include/book.php');
(Document where the function is).
if ($submit) {
$worked=book($day,$month,$year,$total,$title,$forename,$surname,$address,$town,$county);
if ($worked){
Header("Location: http://www.domain.co.uk/confirmation.php");
}
}
This is so when you press submit, the function 'book' is run, this emails the details to me, and enters info into a database. If it works I want it to forward to confirmation.php which gives a confirmation screen. However if it doesn't work, I want it to show error feedback. In the book code, i have
if (!$day || !$month || !$year || !$total || !$title || !$forename || !$surname || !$address || !$town || !$county) {
$feedback .= ' ERROR - Please Fill In All Fields ';
return false;
}
However even if these fields are left blank, the form still forwards onto confirmation.php, but surely $worked would return false and not work?
Any help greatly appreciated
Cheers
Ben