All you need to do is check to see if the submit variable exists. That is if you create it in your form.
<input type="submit" name="submit" value="1">
That will cause a variable called $submit to appear in the script that your form calls.
Since you want to have the form call the script that it is currently in then you just need a clause at the top that does something like this.
if (isset($submit)) {
// process form here
}
else {
// display form here
}