View Full Version : Use Inline form validation instead of error pages.
02-04-2007, 11:18 PM
Right now, if my form validator catches an error, it shows a new page with the error message on it. That page is a clone of the page with the form, except for the error message.
How could I have the error message show up inline without having duplicate error pages?
(I know it has something to do with GET, but I've never really used it before)
you could run a google for "multi purpose pages php" and i'm sure that some tutorials would pop up that handle this.
or you could post your code of the formgenerating and the formprocessing page so that we can merge them and show you how it can be done...
02-05-2007, 04:56 PM
I use a couple of different methods, first (I believe what raf calls multi-purpose) is to put your validation and form processing code in the same page as the form and have the form action set to itself ($PHP_SELF). Use one or more vairables to hold error messages print them out where ever your want on your form page.
If you can't have your form post to itself, post it to your validation script and if there are errors send the user back to the form via header. You can use a session to pass the error values back to the form to be displayed.
I'm self taught so these may not be best practices but I use both methods without any issues, although I prefer the first method whenever possible.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.