having trouble with eregi function
Posted: Fri Dec 05, 2003 1:25 pm
I can't seem to get this thing to work! I'm trying to validate an email form to only contain a regular email address. But it keeps coming back 'nope', which as you'll see below means that the email address is invalid. The test email variable has been set to a common type of email address, so if it works correctly, it should return a 'successful' statement.
The code is a simplified form I have been practicing with, not the full form. Is there a syntax problem? I can't find one.
Thanks,
Dave
The code is a simplified form I have been practicing with, not the full form. Is there a syntax problem? I can't find one.
Code: Select all
<?php
$sal = "testmail@aol.com";
if (eregi ("^[[]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$", $sal)) {
echo '<p>successful</p>';
} else {
echo '<p>nope</p>';
}
?>Dave