In the beginning of your script, check to see if a variable has been set and let your script act accordingly. In other words
if (!isset($somevariable)) {
// do process here
}
else {
// show default
}
once the user hits submit, set the $somevariable to some value and try it again. In addition, you may want to try setting cookies on the client machine using (PHP and/or JavaScript) and determining whether or not the user has hit the submit button already.