NickG21 Posted December 15, 2006 Share Posted December 15, 2006 hey everyone i'm new with php and i am working on my first e-mail validation script. the script looks right to me and when i look through the syntax of other scripts seems to be alright but will not work. here is my code and my error if you could help it'd be appreciatedthanksCode:<?php$message = "";$email = "basictext";if ($_POST['process'] ==1) {$pattern = '/.*@.*\..*/';$email = $_POST['email'];//if (preg_match($pattern, $_POST['email']) > 0 //header("location: thanks.html");$message = "Please Enter A Valid E-Mail Address";}?><html><body><form action="test.php" method="post"> <? if ($message != "") {print $message;}<span class = "<?print $email; ?>">Email address:</span><input name="email" type="text" size="20"class="<? print $email; ?>"><br/><input type="hidden" name="process" value="1"><input type="submit" name="button1" value="Sign Up!"></form></body></html>Error:Parse error: parse error, unexpected '<' in /home/web/www.netatlantic.com/test/nickgirard/test.php on line 24 Link to comment https://forums.phpfreaks.com/topic/30786-form-validation-error-with-e-mail/ Share on other sites More sharing options...
kenrbnsn Posted December 15, 2006 Share Posted December 15, 2006 You didn't leave PHP before resuming HTML here:[code] <? if ($message != "") {print $message;}[/code]Ken Link to comment https://forums.phpfreaks.com/topic/30786-form-validation-error-with-e-mail/#findComment-141924 Share on other sites More sharing options...
ted_chou12 Posted December 15, 2006 Share Posted December 15, 2006 here:[code]<?php//email right format, valid?$regex = "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)*"."@[a-z0-9-]+(\.[a-z0-9-]{1,})*"."\.([a-z]{2,}){1}$";if(!eregi($regex,$email)){echo"(Invalid E-mail Address!)<br>"; $invalid = TRUE;}?>[/code] Link to comment https://forums.phpfreaks.com/topic/30786-form-validation-error-with-e-mail/#findComment-141927 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.