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 5 of 5
  1. #1
    New Coder
    Join Date
    Jul 2002
    Location
    Florida, USA
    Posts
    96
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Reposting Form Data (Hitting Back on Browser)

    Anyone have a way to repost form data after hitting the browser back button without the user having to hit retry?

    Thanks!

    Eric
    if ( bad && possible ) happen();
    Sig re-written for faster processing...

  • #2
    Regular Coder
    Join Date
    Apr 2004
    Location
    Birmingham, MI
    Posts
    131
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I would think that would depend on the User Agent. You want the form to be reposted after hitting back? Usually that causes a box to popup saying POST session expired, do you want to resend? Or something of the sort.

    Are you trying to fill in the form fields with data that was already entered if part of it failed validation? If so, there are better ways to accomplish this than by using the back button, or javascript to emulate the back button.

  • #3
    New Coder
    Join Date
    Jul 2002
    Location
    Florida, USA
    Posts
    96
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Exactly. I use a combination of Javascript and PHP to do the form validation and processing. Its rare for this to happen, but when it does it causes grief. When one of my techs hits the back button then hits 'Retry', it wipes out what they had entered. This is for a call tracking app that I've written and sometimes the techs have entered a lot of information -- which gets gone.
    if ( bad && possible ) happen();
    Sig re-written for faster processing...

  • #4
    Regular Coder
    Join Date
    Apr 2004
    Location
    Birmingham, MI
    Posts
    131
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So the problem is with php validation then? Well then:

    Sticky forms!

    Include the form with include();
    put value="<?php echo $_POST['fieldname']; ?>"

    If you include the form again when validation fails, and have value="<?php echo $_POST['fieldname']; ?>" in their respective places, all the data will still be there.

    This also gives you the oppurtunity to post in red what did not validate, on top of the form, or put a pretty red asterisk next to the culprit.

    Edit: Best part: They won't have to hit the back button any longer!
    Last edited by circusbred; 10-06-2004 at 08:13 PM. Reason: Oh yeah, most important part!

  • #5
    New Coder
    Join Date
    Jul 2002
    Location
    Florida, USA
    Posts
    96
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmmm. Good idea. Thanks!
    if ( bad && possible ) happen();
    Sig re-written for faster processing...


  •  

    Posting Permissions

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