Keep entered data and take it to another page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
myplaces
Forum Newbie
Posts: 11
Joined: Wed Nov 12, 2008 3:25 pm

Keep entered data and take it to another page

Post by myplaces »

I have file retain.php with forms. In these forms i enter necessary data, then go to another page to continue enter data (two pages are necessary, because i need to enter many data and if in one page, the page would be very long and will load slowly).
When I enter data in second page, i click on button, opens third page, in which i work with entered data.

My problem is that i dont know how data entered in first page to take to third page.....

In third page i get displayed only number 02 (not number 01)

retain.php
<html>
<head>
<title>...</title>
</head>
<body>
<h1>...</h1>
<form method = "POST" action = "retain01.php">
<table border=0>
<tr>
<tr>
<td align="right">Number 01:</td>
<td><input type= "text" name= "number01" value="<?php echo $number01; ?>" size= "40"><br /></td>
</tr>
<tr>
<td>
<input type="Submit" value="Submit"></td>
</tr>
</table>
</form>
</body>
</html>
------------------
retain01.php
<html>
<head>
<title>...</title>
</head>
<body>
<h1>...</h1>
<form method = "POST" action = "retain02.php">
<table border=0>
<tr>
<tr>
<td align="right">Number 02:</td>
<td><input type= "text" name= "number02" value="<?php echo $number02; ?>" size= "40"><br /></td>
</tr>
<tr>
<td>
<input type="Submit" value="Submit"></td>
</tr>
</table>
</form>
</body>
</html>
-----------
retain02.php
<html>
<head>
<title>...</title>
</head>
<body>
<h1>...</h1>
<?php
$number01 = $_POST['number01'];
$number02 = $_POST['number02'];
?>
<table width="600" id="table_r">
<tr>
<td id="td_r" width="500">Number 01</td>
<td id="td_r" width="100"><?php printf("%.2f", $number01); ?></td>
</tr>
<tr>
<td id="td_r" width="500">Number 02</td>
<td id="td_r" width="100"><?php printf("%.2f", $number02); ?></td>
</tr>
</body>
</html>
cavemaneca
Forum Commoner
Posts: 59
Joined: Sat Dec 13, 2008 2:16 am

Re: Keep entered data and take it to another page

Post by cavemaneca »

cookies? look into cookies. you would want a unique name for each variable to store in the cookie, then on the last page load all of the variables from the cookie, send the data, and if it succeeds, wipe the cookie clean of those variables.
myplaces
Forum Newbie
Posts: 11
Joined: Wed Nov 12, 2008 3:25 pm

Re: Keep entered data and take it to another page

Post by myplaces »

Thanks for info. I will try.
Post Reply