473,574 Members | 2,530 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 18233
> 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 New Member
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
ibme_uk
1 New Member
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="selec ted" 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("Lo cation: {$_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
7546
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. 2. When anybody click on those links, it will open a new windown.
1
4275
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 with derision, so let me explain: (1) The site is actually a web-based application, not a "web site" per say, and is not accessable by the public. ...
4
7592
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 is that browser navigates to desired page as expected and go back from where it started! But, the 'Back' button on browser works normaly. I dont get...
8
2555
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 courses are populated. When course is selected, lists of occurrences, groups and
6
10670
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. Let's say you select 1 of the items, and are properly redirected. You press the back button. I have three servers providing two different...
29
3968
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. The submit button posts the page back to the server. The button code detects an entry error and sends the page back to the user. This all works. ...
6
1933
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: myNextButton.Attributes.Add("onclick", "return confirm('Are you sure you want finish this test?');") to attach a popup box to a button. The problem is that the buttons only say OK...
5
2389
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 point in the initialization of the app, I determine a navigational structure; what benefit is first, second, etc., therefore, which page to display...
7
2474
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 click on button1, it populates the text boxes with person1 details. When I click on button2, it populates the text box with person2 details and...
5
2993
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 page to prevent user to navigate back but its not very effective. The server side scripting is done using ASP. you may ask that why at first...
0
7815
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8257
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7828
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8113
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5634
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5316
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3755
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2253
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1076
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.