to place all the forms in a separate file, each as a function
<?
function logon_form(){
echo "<form name=\'logon\' method=\'post\' action=\'login.php\'>
<table><tr><td>Username:</td><td><input type=\'text\'
name=\'username\' value=\'$username\'></td><tr>
<tr><td>password</td><td><input type=\'password\'
name=\'password\'></td></tr><tr><input type=\'submit\'
value\'log in\'>";
}
?>
then include the common file in the page that i am presenting, in this case login.php
<?
require("common.php");
if (!$submit){
logon_form();
exit();
}else{
//do the rest of the log in checking
//if not all variables are filled in then show the form again
if ((!$POST['username']||(!$POST['password'])){
logon_form();
}else{
//authenticate user
}
}
?>
this way when the form is called again in this page, the values for $username has already been set (if filled in) and can be passed back to the user for editing if not authorized in this case...(note: you may not want to tdo this with a logon form, but the principle is the same for any form)
this way you can also eliminate the need to have the user hit the back button (not user friendly design IMO 🆒 ) as the form is simply presented again to the user if the login fails...this method also allows for editing of previously submitted data by simply doing a sql query and passing the info back to the user for whatever they are trying to do...
hth