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

redirect data by click back button

121 100+
Hi,

Here i have a doubt

i have two forms one to fill the data in the input boxs once i filled 1st form then i am submitting the data to next page . So in next page i have one back button if i pressed back button i should get previous data means 1st form data with related fields and this should be in php


Thanking you
Sep 11 '07 #1
3 2925
Atli
5,058 Expert 4TB
Hi.

Didn't really understand what you just said.
What I think you mean is...

You have two forms on separate pages. The first form posts its data to the page that contains the second form. Once there, you have a back button that, if clicked, sends you back to the first page, where you want the form re-filled with the data it originally sent to the second page.

Does that sound about right?

If not, please try a better explanation. The quality of our answers are highly dependent on the quality of your questions.
Sep 11 '07 #2
sbettadpur
121 100+
Hi.

Didn't really understand what you just said.
What I think you mean is...

You have two forms on separate pages. The first form posts its data to the page that contains the second form. Once there, you have a back button that, if clicked, sends you back to the first page, where you want the form re-filled with the data it originally sent to the second page.

Does that sound about right?

If not, please try a better explanation. The quality of our answers depend very much on the quality of your questions.


sorry for the improper explanation, what u think is absolutely right?
in the second form i have back button(which link to form1 page) or back hyperlink(which link to form1 page). if i press back button or link(back) the form1 should have data that i recently entered.

thanks for reply
Sep 12 '07 #3
Atli
5,058 Expert 4TB
Ok.

The simplest solution would probably be to use sessions. You can read more about sessions in this article.

Consider this example:

Page1.php
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.   # Start session
  3.   session_start();
  4.  
  5.   # Check if the data exists in the session.
  6.   # If it does, save it and use it as the value
  7.   # for the <input> field.
  8.   $data = "";
  9.   if(isset($_SESSION['data'])) {
  10.     $data = $_SESSION['data'];
  11.   }
  12. ?>
  13. <form action="Page2.php" method="POST">
  14.   <input type="text" name="data" value="<?php echo $data; ?>" />
  15.   <br><input type="submit" />
  16. </form>
  17.  
Page2.php
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.   # Start session
  3.   session_start();
  4.  
  5.   # Check if data was posted
  6.   # If it was, set the session variable
  7.   # so that Page1.php can use the value
  8.   # if the user clicks the back button.
  9.   if(isset($_POST['data'])) {
  10.     # Set the session
  11.     $_SESSION['data'] = $_POST['data'];
  12.   }
  13.  
  14.   # Print message and back link
  15.   echo "You posted '". $_POST['data'] ."'";
  16.   echo "<br><a href='Page1.php'>Go back to Page1</a>";
  17. ?>
  18.  
As you can see. In Page2 I save the data that was posted from Page1 in the session. Then, if the user clicks the back button, Page1 can use the session variable from Page2 to fill the form with it's old values.
Sep 12 '07 #4

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

Similar topics

7
by: Donna Hawkins | last post by:
I want to use javascript to redirect to a URL which has been passed as a variable (in php). I have searched but cannot find any solution. I think this code is a basic redirect: <script...
6
by: DotNetGruven | last post by:
I've got a page that does a search... There is an ImageButton on it that allows the user to reset the search. The Click Handler for the button clears out the Data and then redirects to the same...
2
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control...
7
by: Markus McGee | last post by:
Hi all, I have a quick question...I believe. On my web page, call it page A, I have a drop downlist with runat server enabled. When the drop downlist change event occurs it repopulates a...
4
by: csgraham74 | last post by:
I have an issue with aspx page that displays a large datagrid. When i click a button and display the grid everyting works fine. when i click a button on the page which is a response.redirect to...
3
by: neil_pat | last post by:
I have a stored procedure which returns a value of between 0 and 4. I want the user to press a button to receive feed back on their last input. The save button takes the input and saves it to...
5
by: Tmuld | last post by:
Hello, How do I return to a page using response.redirect - keeping the state value? Right now I have a back button - on pressing it - it send the user back to WebForm1.aspx - but all the...
4
by: Kasey | last post by:
Problem: ------------------------ I have a list of names that spill over onto other pages. The user can click on the pages to advance and see more names. The user can click on a name to edit...
4
by: nkoier | last post by:
Hi, I've been going crazy trying to figure out what's wrong with our Asp.Net 2.0 intranet site. At the very top of our main page I provide a TextBox and a Button for submitting Google searches....
7
by: seanmatthewwalsh | last post by:
Hi I have a page (default.aspx) that pulls it's HTML from a database. I then have a "content management" page (editpage.aspx) that allows the user to edit the HTML in the database. When the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.