The javascript is a popup calendar for populating that field or in the
example I posted it is just a browser popup. If the page is served as .htm
everything is "fine." Served as .php the form is empty on BACK unless the
javascript is not called.



Really the data is not there (because when I view the source either way,
value="" but the browser remembers it (except in the js+php scenario) so on
submitting again it is re-posted.



My goal is to allow the user to use the browser back button to make changes
and also do some neat things with javascript for the forms (ie. popup
calendar, clear certain text fields when others are populated etc.)



This would be accomplished if I simply use .htm page(s) instead of .php but
unfortunately there are some lists that get pulled from a db. If there were
a such thing as include(file) in html that would work LOL.



Anyhow maybe you have a chance/interest in seeing exactly what I am talking
about. Try making a .htm file and a .php file with these contents. With
each, fill out the 2 fields and click on the 3rd which will open a popup
window. Submit the form and go back. The .htm one will still have the "data"
whereas the .php one won't. Try it without clicking the 3rd field and they
both will have the data when going back. Assuming we are using the same
browser (IE6?)



Thanks again and if you wouldn't mind sending your sample transfer script
stuff that would be great so I can consider the alternatives.



-Paul-





-----Original Message-----
From: Richard Davey [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 06, 2004 8:38 PM
To: Paul F
Subject: Re[4]: [PHP] Bizzare form problem - Please Help!



Hello Paul,



Wednesday, January 7, 2004, 2:32:59 AM, you wrote:



PF> Also... what about changing the cache control? And one more question, if



The headers I posted were the default PHP ones. I do not know how to

configure PHP to change them, it's probably a server setting

somewhere. Even if you could, there's no guarantee a browser will pay

heed to them anyway.



PF> this is indeed the case, then why is does the data still appear to be
there

PF> if I remove the javascript or do not trigger the event?



What exactly does this JavaScript do? At the end of the day, the value

is either in the form or it isn't really.



-- 

Best regards,

 Richard                            mailto:[EMAIL PROTECTED]



"Richard Davey" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello Paul,
>
> Wednesday, January 7, 2004, 1:45:20 AM, you wrote:
>
> P> Thanks. The problem exists either way! For some reason that is beyond
me,
> P> the combination of a javascript being called and the document being
parsed
> P> through php is the cause. Again if I simply rename to .htm then it is
> P> "fine."
>
> It's not the JavaScript causing it (see below).
>
> P> I would prefer not to have to tell the users "dont use the browser back
> P> button, use the back button icon on the page instead." and force the
page to
> P> not be cached. Any other ideas?
>
> Look at the standard HTTP Header from a PHP session:
>
> HTTP/1.1 200 OK
> Date: Wed, 03 Dec 2003 03:02:04 GMT
> Server: Apache/1.3.27
> X-Powered-By: PHP/4.3.2
> Set-Cookie: PHPSESSID=9698e85f93d57ec844194ae7943552c8; path=/
> Expires: Thu, 19 Nov 1981 08:52:00 GMT
> Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
> pre-check=0
> Pragma: no-cache
> Connection: close
> Content-Type: text/html
>
> Specifically the cache-control. PHP has these settings by default so
> you can NEVER rely on the browser to "remember" form data because if
> it adheres to the HTTP Headers (which it ideally should), it's going
> to blank it all.
>
> Here's an option for you that I use:
>
> 1) On your page with the form, submit the data via a transfer
> (XT) script. This script places all of the form values into session
> variables and then redirects to Page 2.
>
> 2) On the next page display whatever you need. If they click BACK in
> their browser, it's going to return to the first page, not your XT
> file. This page should, at the start of it, check for the existence of
> the session variables. If they exist and the data is safe, populate
> the form with it.
>
> Basically using this method you can "save" the form contents for
> however long you want the session to exist and when they go back to
> that page (either by typing the URL in directly or using the Back
> button in their browser) the data will be ready for you to populate
> the form with.
>
> If you want some example code just shout.
>
> -- 
> Best regards,
>  Richard                            mailto:[EMAIL PROTECTED]

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

Reply via email to