Posted June 23, 200519 yr Hey i'm a php n00b. I have been teaching my self php for a couple of weeks and can do most ok just debugging it is problem cos i don't know what all the error mean. can someone help this is what i have. <?php $echeck = $_POST['email']; if (ereg("^([a-zA-Z0-9_-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([a-zA-Z0-9-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$", $echeck) line 8 -> { echo "<br>Please enter a valid e-mail address."; } ?> this is the error. Parse error: parse error, unexpected '{' in /home/public_html/file.php on line 8 'line 8 ->' is just to point not actually in code. thanks
June 23, 200519 yr Very simple, you're missing a ')'. if(ereg("^([a-zA-Z0-9_-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([a-zA-Z0-9-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$", $echeck)) { echo "<br>Please enter a valid e-mail address."; } Also, ereg returns true if the string matches. Therefore, if(ereg(your stuff)) on a valid-format email address returns true, so you're telling them, that if they enter a valid email, they're not. Place a '!' infront of ereg
June 23, 200519 yr Author ViperX said: Very simple, you're missing a ')'. if(ereg("^([a-zA-Z0-9_-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([a-zA-Z0-9-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$", $echeck)) { echo "<br>Please enter a valid e-mail address."; } Thanks i though i checked for that, must have missed the one at the start of the if statement.