Hi there. Sorry for the delay in responding. Below is the methodology you will have to follow to do what you are looking for:
1) HTML FORM
Build your standard html page with the form in question. But somewhere in the area of the form, you will want to add the following check:
<?php
if (!isset($_GET['db_err']) || $_GET['db_err'] != 1) {
echo '<strong style="color:#ff0000">output error message</strong>';
}
?>
This will be used after you've processed the form and checked if there are any errors.
In the input field for the name
<input type="text" name="name" value="<?php if (isset($_GET['name']) echo $_GET['name']; ?>" />
2) PHP PAGE TO PROCESS FORM DATA
You will need to write the code that will process the form data, and perform the check you've coded in the ParseForm function below. Then based on the results of $numrows from your ParseForm function
<?php
if ($numrows >=1) {
// set the db_err flag to 1 and on form.php the error message will be displayed
header('Location:form.php?db_err=1&name='.$_GET['name']);
} else {
// do what you will if no error reported
}
Hope this helps.
Cheers,
Pablo