473,406 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Forms Back loose data

sumaiya
43
When a user submits a form and clicks on the back button how can he view his already entered data??

I really need to knw this.

I mean the user shouldnt loose his data if he encounters an error after submitting.

Waiting for your reply.
Apr 28 '07 #1
3 1252
sumaiya
43
Hey guys, i got the solution......... its pretty annoying but simple.

Just use cookie.

<?php
setcookie("user", "Alex Porter", time()+3600);
?>


and

<?php// Print a cookieecho $_COOKIE["user"];// A way to view all cookies
print_r($_COOKIE);
?>


does the trick............ your user wont be annoyed when he fills forms on your website
Apr 28 '07 #2
pbmods
5,821 Expert 4TB
Cookies can be an annoyance by themselves, especially if your User turns them off or disables JavaScript.

Are you trying to save the data when the User submits the form, or when he navigates away from your page?

If you just want to save the data when the User submits the form, all you have to do is store the User's input in the session --

[php]
foreach($_REQUEST as $key => $val)
if($key != 'PHPSESSID')
$_SESSION['form1data_or_whatever'][$key] = Validator::makeSafe($val);
[/php]

This assumes, of course, that you wrote a validator class to safe your input. If you didn't, you could use validator.class.php .

Anyway, then on your HTML form:

Expand|Select|Wrap|Line Numbers
  1. <input name="email" type="text" value="<?php echo $_SESSION['form1data_or_whatever']['email']; ?>/>
  2.  
Bonus points if you set up a Smarty tag instead!
Apr 28 '07 #3
acoder
16,027 Expert Mod 8TB
When a user submits a form and clicks on the back button how can he view his already entered data??

I really need to knw this.

I mean the user shouldnt loose his data if he encounters an error after submitting.

Waiting for your reply.
Generally speaking, the form data should not be lost if you press the back button unless you prevent caching and force a reload of each page.
May 1 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Al Jones | last post by:
I have an application - an insurance form - which requests personal data on form one. If the user checks auto or homeowner (or both) on the first form I need to collect data from each of these...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
0
by: Anonieko Ramos | last post by:
ASP.NET Forms Authentication Best Practices Dr. Dobb's Journal February 2004 Protecting user information is critical By Douglas Reilly Douglas is the author of Designing Microsoft ASP.NET...
6
by: Manny Chohan | last post by:
I am using forms authetication in the web config. i can validate a user against a database and click on images which makes hidden panels visible.However when i click on the link inside a panel...
5
by: matt | last post by:
hello, i am on an interesting project. in this project, i have to create dynamic data-entry forms for offline-users to fill out, save locally, and eventually postback to our app (when back...
23
by: mosesdinakaran | last post by:
Hi All, I need a small clarification in submitting the forms, Ur suggestions please. In a page I have two form and also two submit butons. (ie)
14
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3 forms. I want allow users to move forward and backward with the forms and retain the data users have entered. I thought...
2
by: Toni Pohl | last post by:
Hi, some years ago I´ve implemented an classic ASP form which fills in data from a database into a PD-form. I used the free FDF Toolkit which worked very well. After submitting the PDF the...
21
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.