One good method is to use default $message="";
Then in your FORM Template, you have a display of this variable.
In your re-submitted form eventual error or other info messages
are displayed above or below the form.
Using the value of this $message variable.
Otherwise can an empty string be displayed.
This variable can also be used to indicate if there is an error or if form was correctly filled.
As long as it has not been assigned an error message (it is still empty), then is no error.
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==0){
$message = "username is not taken";
}
else {
$message = "username is taken";
}
Also the POSTed values, like $username
can be re-transfered into form, if the form is needed to be re-displayed:
<input type="text" name="uname" value="<?php echo $username; ?>">