Chris, Hi there:
Well it don't work! here is the function:
function checkEmail($email) {
if ((empty($email)) || (!(ereg(".+@.+..+$", $email)))) {
$error = "<p>Email address has been ommitted or is invalid!</p>";
return $error;
}
else {
return $email;
}
}
The function is called from another page thus: include("bin/includes/functions.php");
if($submit) {
checkEmail($email);
}
<?php echo"$error"; ?> //Echoed within HTML
In the function using: echo "<p>Email address has been ommitted or is invalid!</p>"; echoes the error message to the top left of the screen, I want it to display within the HTML, so I thought:
$error = "<p>Email address has been ommitted or is invalid!</p>"; in the function would be fine but it does nothing! What's wrong with it do you think?
Cheers.
Russ