473,415 Members | 1,519 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,415 software developers and data experts.

Back button

Hello,

I have two questions.

1. When the user presses the back button and returns to a form he filled
the form is reseted. How do I leave there the values he inserted?

2. When the user comes back to a page where he had a submitted POST data
the browser keeps telling that the data has expired and asks if repost. How
to avoid that? I tried registering all POST and GET vars as SESSION vars but
it also has its disadvantages...

Cheers,
Albert Ahtenberg


Jul 16 '05 #1
4 18089
> 1. When the user presses the back button and returns to a form he
filled
the form is reseted. How do I leave there the values he inserted?
A) The browser hasn't sent any data, so you cant get it, therefore
everything is browser dependant, and you cant do anything about it as far as
I know (unless there is some obscure meta tag).

B) Many browsers store the information, and if a user leave the page, by any
method, but can return to it using 'next' and 'back', then the data may
remain, otherwise it is almost certainly lost.

C) If you can grab the data, and know it's the correct user, you can read it
while outputing the page, and stash it in the 'value' and 'checked'
attributes.
2. When the user comes back to a page where he had a submitted POST data the browser keeps telling that the data has expired and asks if repost. How to avoid that? I tried registering all POST and GET vars as SESSION vars but it also has its disadvantages...


As far as I know, the page will be reformed. Any data that was given to that
page through get/post/session/your database/files will be shown. Anything
that user entered will be lost (if they have to resubmit the data).

However, I'm not familiar with session usage, so I can't say for certain.

hope this helps,
-Jim Stapleton
Jul 16 '05 #2
glgyn
1
1. When the user presses the back button and returns to a form he filled
the form is reseted. How do I leave there the values he inserted?
If you're working with sessions...
Add this line right after calling session_start() to solve the problem:
header("Cache-control: private");
Now, users can hit the back-button to access the form containing all the information they've inputted before.
Font: http://br2.php.net/manual/pt_BR/func...tart.php#29798

[COLOR=Navy]Agora em português[/COLOR]
Se você estiver trabalhando com sessões...
Adicione essa linha logo abaixo da chamada a session_start() para resolver o problema:
header("Cache-control: private");
Agora, os usuários podem clicar no botão voltar para acessar o form contendo todas informações que tenham inserido antes.
Fonte: http://br2.php.net/manual/pt_BR/func...tart.php#29798
Aug 17 '05 #3
If you're working with sessions...
Add this line right after calling session_start() to solve the problem:
header("Cache-control: private");
Now, users can hit the back-button to access the form containing all the information they've inputted before.
Font: http://br2.php.net/manual/pt_BR/func...tart.php#29798

[COLOR=Navy]Agora em português[/COLOR]
Se você estiver trabalhando com sessões...
Adicione essa linha logo abaixo da chamada a session_start() para resolver o problema:
header("Cache-control: private");
Agora, os usuários podem clicar no botão voltar para acessar o form contendo todas informações que tenham inserido antes.
Fonte: http://br2.php.net/manual/pt_BR/func...tart.php#29798
Signed up just to say thank you! you have just got rid of a very big headache!
Mar 28 '06 #4
Albert Ahtenberg wrote:
Hello,

I have two questions.

1. When the user presses the back button and returns to a form he filled
the form is reseted. How do I leave there the values he inserted?
I always capture the values into a session and when the form is created
I echo the session values into the value="" section, or whatever is
needed, different in the case of checkboxes etc., have to mark as
selected="selected" etc.

You could use normal cookies too if you don't want to start a server
session.
2. When the user comes back to a page where he had a submitted POST data
the browser keeps telling that the data has expired and asks if repost. How
to avoid that? I tried registering all POST and GET vars as SESSION vars but
it also has its disadvantages...
I usually use a header redirect back to forms when data is invalid or
when a succesful submission is made, I use a session var 'messages' to
hold any messages to print at the top of the form

eg.

$_SESSION['messages'] = 'Your submission was invalid';
exit(header("Location: {$_SERVER['PHP_SELF'}"));
Sep 14 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: KK | last post by:
Hi, I am using history.go(-1) for implementing the back button functionality. Its working fine but with this exception. 1. The page which is having back button has some hyperlinks on it. ...
1
by: Peter D. Dunlap | last post by:
Hello, I realize that this may not be the best place to ask this question, through the application is asp.net. I also realize that questions about disabling the back button are generally met...
4
by: Hypo | last post by:
I added a 'Back' button to my page, and wrote 'OnClick' code something like this: Response.Write("<script>history.go(-" + iDepthIndex.ToString() + ");</script>"); But, it dosnt work! Effect...
8
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and...
6
by: Mark | last post by:
I have two dropdown lists. Both have autopostback set to true. In both dropdowns, when you select an item from the list, it redirects to the Value property of the dropdown. Nothing fancy. ...
29
by: Tom wilson | last post by:
I can't believe this is such an impossibility... I have an asp.net page. It accepts data through on form fields and includes a submit button. The page loads up and you fill out some stuff. ...
6
by: tshad | last post by:
I am trying to set up a Javascript popup box that has a way of sending back a message to asp.net on how to process some data. At the moment I am just doing: ...
5
by: Tom wilson | last post by:
I'm developing an application that is a benefits enrolment website. The benefits can be of any type in any order as stored in a SQL server. On each page is a Back and Next button. At a certain...
7
by: Sridhar | last post by:
Hi, I have a question regarding the Page_Load method and Back Button of Internet explorer. I have created a webform. In that webform I have several Text Boxes. Also I have two buttons. When I...
5
by: ns21 | last post by:
How can the browser back button be disabled If the form is submitting information to other pages or submitting to itself or using redirections. I tried the tweaks like history.forward(1) in each...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.