>From my experience, Jay's explanations are correct, but let me try another
tack.

It is my understanding that when you press the back button on a browser, the
browser tries to present the page the same way it presented it the first
time it was presented, from information it saved in it's history stack.
When you came to this page the first time, it presented an empty form.  When
you go back to the same URL (using the back button) it presents the same
empty form.

When you press the submit button, you are probably telling the browser to
post your filled in data to a different URL, and the back button takes you
away from that URL to the one with the empty form.  It may be possible to
fake out the browser, by having it post form data to the same URL as the one
presenting the empty form, but I would be surprised if that worked the same
for all browsers.  Perhaps this is the situation where you saw it appear to
retain your data.

So much for the problem you are encountering, one of your next challenges
will be the following;

If you enter a page with a POST as in the submission of a form with a method
of post, and then click submit on that page, going on to a third page (again
with a post), and then click the back button, most browsers will complain
(both IE and Netscape do).  Seems that if a URL was entered via a "post" and
you manage to click back to that same page, the browser appears to not save
enough information to re-present the page, and will ask you to click the
refresh button.  For this reason, I make it a practice of directing all my
forms to one URL that will process the form data, and then redirect the
browser to a new url (see the header function) for presenting the next page.
This causes the browser to replace the "post" url with the redirection url
(always a get), so that the back button will only remember the redirected or
get pages.  I haven't found a more elegant solution, so if there is another
out there, I'd appreciate hearing about it.

good luck,

Warren Vail

-----Original Message-----
From: Jay Blanchard [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 18, 2003 1:09 PM
To: b b; [EMAIL PROTECTED]
Subject: RE: [PHP] Prefilled forms


[snip]
 I don't think you understood my question. Off course
you have to store data in a database  or a session var
if you want to retrieve them later on.

 My problem is not there. I hava a form, I click
submit and right after that I hit back. Usually in
most cases the form will be prefilled with what I
entered. In my case I am getting a totally blank form.
This is only hapenning with forms from my server. 
[/snip]

This AFAIK is the expected behaviour. Once you have submitted the form
all of the input values will be blank when you return to the form unless
you do something to specifically reload the variables into the form.
YMMV from OS to OS, browser to browser. There is only one realiable way
to do it cross-platform and these were mentioned above. You never
mentioned your server config, your browser, your OS, so I am only making
a S.W.A.G. at it. There is nothing IIRC that you can configure in the
php.ini, httpd.conf, or other configuration file. You may have a browser
setting that affects this, but since we know not your browser type it
would be hard to help you locate that.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to