Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Saving Dynamic Web Page Data without Submit?

Posted on 2003-10-28
3
Medium Priority
?
264 Views
Last Modified: 2012-05-04
I'm using PHP and MySQL - I have an email form which the user fills in the To:, Subject and Body then clicks on submit - the problem is that a lot my users are starting to fill out the form and then they click on the Back button and then the forward button (don't ask me why) and the data they typed in is gone!! They don't understand how dynamic web pages work vs static pages, etc. Is there a way for me to save the data to my php variables before the user clicks the submit button so that when they Fwd back to the page I can restore the data that was there?

Thanks...
0
Comment
Question by:rfresh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 13

Expert Comment

by:lozloz
ID: 9638344
this is probably more a javascript question than a php question.. my javascript ain't so hot so i don't know if it can done but i'd imagine you'd have to have an event which relates to browsing away from the page to store the information in a cookie and then load it up again.. this isn't very easy and seems like a lot of effort, maybe just a simple message at the top saying "don't browse away from this screen before completing the form" would be more appropriate?
0
 
LVL 2

Expert Comment

by:errows
ID: 9639568
Using the onUnload event with javascript, you should be able to save all your form's data.
You can also use onChange on every field, wich might be less efficient...

http://www.devguru.com/Technologies/ecmascript/quickref/evhan_onunload.html

errows
0
 
LVL 1

Accepted Solution

by:
de_wagter earned 500 total points
ID: 9784941
a regular form should not loose it's contents when hitting back and forward. However if you set the page to be expired, then browsers don't cache anymore, and also, if special javascript functions are called to submit the form or loading your page, this also happens.

<html><body>
<form method=post>
<input type=text name=test>
<input type=submit>
</form></body></html>

A simple form like this one should NOT lose its contents hitting back and forward. (please tell me if it does with you!)

If this one keeps its contents, then check your site for any META like no-cache, headers definitions with expire, javascritps changing form values etc...

If this doesn't help you can always post the form using the onUnload even as errows proposed, and keep it in some session variable for example...
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question