Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    May 2005
    Posts
    224
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Use Inline form validation instead of error pages.

    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)

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #3
    Regular Coder
    Join Date
    Jul 2003
    Posts
    262
    Thanks
    1
    Thanked 0 Times in 0 Posts
    In general...

    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •