Reputation: 1458
I have two PHP pages: page1.php and page2.php. In the page1.php there is form with one input box and one clickable button. The action that the button will fire will be the page2.php. My question is how do I store the data entered in the input box in the page2.php without losing the data stored previously. I have captured the data using $_SESSION['data'], however, each time when I press the button on the page1.php the data on the page2.php refreshes.
Upvotes: 1
Views: 231
Reputation: 309
The variable $_SESSION is an array, and you can use it like any other array variable. For example:
$_SESSION['data']['page1'] = $info_page1
As you can see, the $_SESSION variable is an array with keys and values. Then, you can refer the page1.php input value just using $_SESSION['data']['page1']
You should be sure you've put the start_session() function at the beginning of the script.
I hope it would help, and sorry my english :)
Upvotes: 1