Form Submissions ... where to and error handeling
Posted: Sat Jan 24, 2009 7:47 pm
Hello all. My question has to do with how you handle form submissions and the subsequent errors.
Do you post the form to the same file or to another directory all together where you handle all of your form submissions? My concerns with the former are that the code can get really long and scattered if there are numerous inputs and such. Also error handling can require many more lines only adding to the unreadability. On the plus side, I have found that it is much easier to output any errors this way. There is no URL redirection which would lose any variables or errors(...) arrays you may have set.
Posting forms to another directory just makes more sense to me, however I haven't found a reliable way to handle errors and displaying them back out to the user. A co-worker of mine likes to post his forms to an /actions/ dir, test for errors and build a GET string containing any messages to display back to the requesting file, like so. But this gives me one nasty looking URL and I refuse to do it this way.
Any help on this issue would be appreciated. Want I want to do is, POST a form to an /actions/ directory and redirect the user back to the page he came from with any accompanying messages or errors that I want to display without uglifying the URL.
-Ciao
Do you post the form to the same file
Code: Select all
action=""Code: Select all
action="/actions/registrations/"Posting forms to another directory just makes more sense to me, however I haven't found a reliable way to handle errors and displaying them back out to the user. A co-worker of mine likes to post his forms to an /actions/ dir, test for errors and build a GET string containing any messages to display back to the requesting file, like so
Code: Select all
if( $error ){ header("Location: /sign-up/index.php?error=Your_password_must_contain_a_number")Any help on this issue would be appreciated. Want I want to do is, POST a form to an /actions/ directory and redirect the user back to the page he came from with any accompanying messages or errors that I want to display without uglifying the URL.
-Ciao