good practice with multiple forms on a page
Posted 16 January 2013 - 05:36 PM
Is this considered best practice? Is this also what prevents the header already assigned errors that need to be corrected with the ob_start, etc functions?
Posted 16 January 2013 - 05:54 PM
The reason I say this, is because if you use the same page as the recipient, its very hard for you to avoid accidental form resubmission (hitting the refresh button)
You could also use the same page as the processing page (If you absolutely MUST) aslong as you redirect the user to a "confirmation" page, and get them away from that page AFAP (sounds dirty huh!)
But to answer your question, yes -- running your form processing code before ANY character data (even spaces and new lines) will avoid the "headers already sent" error, but if you echo, print, etc, information to the browser before you call header() you will receive that error anyway.
Posted 16 January 2013 - 06:00 PM
Posted 16 January 2013 - 06:08 PM
Posted 16 January 2013 - 06:15 PM
How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq
Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!
Posted 16 January 2013 - 06:33 PM
While that is a decent approach, for that application, in almost every other application its best to process on separate pages, atleast in my professional experience.
Posted 16 January 2013 - 06:45 PM
Is this approach acceptable?
Posted 16 January 2013 - 06:59 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users