This question seems to always have 2 sides to it. If I make a register.php with the registration form, should I have it submit to processreg.php or should it just process all on the same page? Same thing for login.
I have read that it may e more secure to have them on separate pages and you will not run into form resend problems, but what's your take on this matter? I am creating a site with potentially hundreds of thousands (100K+) users on it, should I just make it go to processreg.php, then if it's invalid, redirect back to register.php with the variables stored so user doesn't have to reenter data?

Also, If it is on a separate page, does that mean I can process the form with AJAX, for validation and what not? I guess I can always use JavaScript form validations. Any and all input is much appreciated.

little off from main point, but would not be cool if the whole registration was a function? Like would that NOT be recommended?

Recommended Answers

All 2 Replies

Even if you use another process reg page you can still send the entered data back to main form in case of error.

If you want to send data to same form, you may use cookies to overcome resend issues.

Ajax can work in any way, one page or two page.

I personally feel one page coding is always little complicated (either for processing or for ajax).

So go for separate process handler.

If you have a well-structured programming style you can put your whole website script into one file.
If your input and your processing code is in the same file chances are higher that you (and your fellow programmers) spend less time searching for it. And re-factoring might be easier, depending on your tools.
Make sure that your code adheres to the MVC model. Do not intermix HTML display and PHP logic. Put your HTML templates for pages and forms in separate files instead of mixing them with PHP code. But don't bother to separate input logic and processing logic on the file level.
P.S.: JS form validation will do you no good if you omit the server-side form validation.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.