I just answered a similar question in another current thread a few mins
ago...

So I'll just copy and paste:

---
Relying on the back button isn't good... the data may or may not be there
when they return.

However, you CAN provide them with a button "change", and POST the data to a
form... where they modify their data, the form needs to echo the POST data
back into the form, eg:

<FORM action="validate.php" action="POST">
    <INPUT type="text" name="username" value="<?=$_POST['username']?>">
</FORM>

selects, checkboxes and some other things are a little more tricky, but
you'll figure them out... search the archives too... it's been asked 1000's
of times :)
---

Other comments in line below:

on 29/08/02 7:37 PM, Jean-Christian Imbeault ([EMAIL PROTECTED])
wrote:

> All answers seem to be of the type "re-populate the form with the data".
> And of course the POST data as to be put into sessions variables. Seems
> like a lot of work for a simple thing.

As I said above, SOME browsers will keep the data when the click back,
others won't.  You can't rely on it either way, but for starters, ensure
that you aren't forcing a no-cache with meta tags or headers.

But I gather you want to ENSURE that they can do this... so you need to do
as I said above... POST the values to a copy of the form, and echo the
values.

Yes, it's a bit of work.


> Do you agree that the only way is for the form data to be put into
> session vars and then re-populate the form?

Nope.  The values don't have to be in SESSIONs at all.  Could be passed to
the form with POST, GET, or even COOKIES.  I'd prefer POST.


> Also can you explain to me the technical reasons why the data is not
> kept when I hit the back button?

Each browser is different.

In my old NN4.7 mac, the values are all there.  But in IE5 mac, the values
are all there, EXCEPT for those in password fields.  In one of my other
browsers, the fields are all blank when I click back.  It may be a security
option/leave setting for each browser.

What you should aim to do is provide a "forward link" to the form, show what
they had, and allow them to change it...


Justin


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

Reply via email to