Info@noreia.ee

50) $errors['name'] = 'Name too long'; // Needs better checking ;) if (!ereg('.*@.*\..{2,4}', $values['email'])) $errors['email'] = 'Email address invalid'; if (strlen($values['text']) == 0) $errors['text'] = 'Text required'; return (count($errors) == 0); } function DisplayForm($values, $errors) { ?> 0) echo "

There were some errors in your submitted form, please correct them and try again.

"; ?>
Name:
Email:
Text:
"); // Replace with actual page or redirect :P echo "Thank you!Thank you!"; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { $formValues = $_POST; $formErrors = array(); if (!VerifyForm($formValues, $formErrors)) DisplayForm($formValues, $formErrors); else ProcessForm($formValues); } else DisplayForm(null, null); ?>