I have a "Create an Account" PHP page.

Assuming the form data is valid, where should control go when the User submits the Form??

1.) Redirect to a New Page?

2.) Load the Page Onto Itself?


My 1st Approach
Code:
HTML to Open Page
If Form Submitted, then...
	PHP to handle Form
	If Account Created, echo HTML with Success Message and Close Out Page with HTML
	If Account Failed, echo HTML with Failure Message and Close Out Page with HTML
else, drop through to HTML Form and Closing HTML
(Having different sets of HTML to close out the web page depending on which fork you go down is insane?!)

My 2nd Approach
Code:
If Form Submitted, then...
	PHP to handle Form
	If Account Created, code=111 and Redirect to "Outcome Page" which looked up 111 and displayed appropriate message
	If Account Created, code=222 and Redirect to "Outcome Page" which looked up 222 and displayed appropriate message
else, drop through to HTML Form and Closing HTML
(This second approach is somewhat cleaner because my "Outcome Page" is one set of HTML with just different messages displayed, and it prevents issues with the User submitting the Form, then hitting the Back button and then the Forward button and creating issues.)

I still feel like this 2nd approach is kinda "hokey" and could use help coming up with a better approach.

(Before going on, let me say I am not ready to learn OOP or MVC, so please keep solutions to plain-vanilla, procedural coding.)


I have heard that using Redirects is a good idea, but I'm just thinking that having this "Outcome Page" is kinda weird.

I dunno?!

The 2nd approach is working okay, but I'm sure it could be better...

Thanks,


Debbie