Or you can have some PHP above everything in your page, set a variable with a default value of null. Send the form to the same page, if it has a value add it to the variable, if not continue as normal.
You could also reset the form action upon setting the variable.