Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Newbie question on php validation


neiljones - 9:17 pm on Aug 18, 2003 (gmt 0)


I have come across a number of examples of code using
action="<?php echo $PHP_SELF?>">
to do validation there is an example below.
But thsi just seems to bring the original page back even when the validation is OK.

what I want is a series of PHP pages that validate and then if correct go onto the next page.
I can't seem to find an example that does both.
All I need to see is how it is done. Have I the wrong approach?
<html>
<body>
<?php
if ($submit) {
if ($pword1!= $pword2) {
$error = "Sorry! The passwords you have entered do not match.";
} else {
// process form
echo "Thank You!";
}
if (strlen($pword1) < 4){
$error ="Sorry! Your password must be at least 4 letters long.";
}
}
if (!$submit ¦¦ $error) {
echo $error;
?>
<P>
<form method="post" action="<?php echo $PHP_SELF?>">
Enter a user name <input type="text" name="first" value="<?php echo $first?>">
<br>
Choose a password <input type="text" name="pword1" value="<?php echo $pword1?>">
<br>
Renter password <input type="text" name="pword2" value="<?php echo $pword2?>">
<br>
<input type="Submit" name="submit" value="Enter Information">
</form>
<?php
} // end if
?>
</body>
</html>


Thread source:: http://www.webmasterworld.com/php/1541.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com