Value (not) being retuned by a function
| From: | MARG | Date: | Sun, 11 Dec 2005 19:55:04 +0000 |
| Subject: | Value (not) being retuned by a function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-227315@lists.php.net to get a copy of this message | ||
Hi,
I have this form:
http://www.tuxdoit.com/newsletter.php
If you care to check it, you'll see that
http://www.tuxdoit.com/formsResult.php
never returns the function value:
formsResult.php:
-------------------------------------
<?php
include('functions.php');
ini_set("display_errors","On");
$email = $_REQUEST['email'];
$emailResult = isEmailOk($email);
print($emailResult);
if ($emailResult == 1)
print('Email Ok');
else
print('Email is not Ok');
?>
--------------------------------
functions.php:
--------------------------------
<?php
function isEmailOk($email) {
print($email);
if (!eregi
("^([-!#\$%&'*+./0-9=?A-Z^_
a-z{|}~^?])+@([-!#\$%&'*+/0-9=?A-Z^_a-z{|}~^?]+\\.)+[a-zA-Z]{2,6}\$",
$email))
return 1;
} // is EmailOk
?>
-------------------------------
Why is that happening ?
Any help would be apreciated.
Warm regards,
MARG