If you are going to validate on a seperate page from your HTML form, then you have to use sesion variables to pass the data back to the form when there is an error.
Something else to consider is, validating the form on the same page as the form... simple example...
<?php
if (isset($_POST["field"])) {
$error = false // error flag
// check for erros here set flag = true if there is an error
if (!$error) {
// do whatever if there are no errors
}
}
?>
<!-- HTML Page -->
<html>
<body>
<form method="post" action="post_to_self.php">
<input type="text" name="field" value="<?php $_POST["field"] ?>">
<input type="submit" vlaue="submit form">
</form></body></html>
You can also do an if statment to check that a particular form element isset in $_POST[] before outputing that data in to the form. You can output the errors anywhere on the page all you have to do is check that the $error = true and then output said error.
There are many different ways to skin a cat, but this eliminates having to to back if there is an error