after pressing submit validate fields i.e.
if ($textboxvalue == "") {
// go back and error
}
then perform an sql request (im guessing you using a database)
"SELECT * FROM databasename WHERE statementnumber = " . $statementnumber . ";";
then check if a result is returned.
if one is then you know you have a result in the database with this number and you can refer the user to whichever page required.
also you will not need to empty any variables as you will always perform this check and if there is a value and they press back it will falg a record is already in the database. Hope this helps