To skip the redirect/reload/5 second delay, I do the following (you're mileage may vary and there's probably 10 other ways of doing this).
I like to submit back to the same page. For me, it keeps things in order. For Java guys, it absolutely drives them nuts. How you do this is up to you.
This is template friendly. If you're not using templates, thats ok.
On my page I'd have:
top section of code to determine what the page needs to do. Does it need to display the form for the first time or does it need to do some processing.
Its the first time so show the form.
User submits the form. Form points the user back to the same page. But this time there's an option set saying the PHP code needs to do a particular action.
PHP page "reloads" but this time with the form data. Does it need to do anything? This time, yes. Go figure out what to do. User submitted form so go do that.
Do your "user submitted form" code here. Keep track of any messages and keep track of the form variables.
Was there an error in processing? Yes: create a message to let the user know what the issue was (this is pretty warm and fuzzy!) No error? Let the user know everything went well (again, warm and fuzzy).
- here's where it gets confusing but is pretty cool -
have the code above return the message that was put together. Don't worry if its an error message or not. You'll be reshowing the form anyways.
When the code returns, then drop the user back into the default form. But this time pass along the form data and the message (if the user is visiting the form for the first time, you can pass the form data and leave the message null and thats fine).
-- -- -- The default form function
Here's where some of the magic takes place. Setup your HTML form to how you want it. At the top of the form, put in a way for your message to get displayed. If its null, it won't display anything so you shouldn't have to do any validation on the message itself unless you wish to get fancy.
Enter in all your form items. But remember this time to put in the default value set to the PHP post variables. I prefer to validate my post variables before I do this step to make sure they didn't enter any HTML code or JavaScript that could muck things up (should be doing this anyways - good security practice).
Example HTML form element:
<input type="text" name="mybox" value="<?=$_POST['mybox']?>">
List boxes and radio buttons are a bit more difficult, but not impossible. You just have to get a little creative. Post here or PM me if you're stuck on it.
And thats it. It sounds complex. But you'll find you only create 1 form and re-use it several times. This isn't the only way to do it, but this is an approach that I like to use. Hopefully I explained it clear enough...