Jump to content

Form Validation Error with e-mail


NickG21

Recommended Posts

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 appreciated
thanks

Code:
<?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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.