Reputation: 153
I have a simple application form it is divided in 3 pages. What I want is when i fill up the 1st page, then when i go to another page the data is still there so I co go back to first page when I want to changes the data I inputted.
I tried saving it in session but I think that is not the right way to do it. any suggestions?
Upvotes: 1
Views: 1831
Reputation: 609
As you post the page, set the values you post in session variables e.g.
<?php $_SESSION['name'] = $_POST['name']; ?>
Then in your input fields, check to see if the session is set & if so they display that. e.g.
<input type="text" name="name" value="<?php if (isset($_SESSION['name'])) { echo $_SESSION['name']; } " />
Make sure you start a session on each page you want to use them on!
<?php start_session; ?>
Upvotes: 2