I have a form that has several textfields. When i click a button the form gets submitted and a new page opens. When i get back to the main page i need to populate the textboxes automatically with the data that has initially been entered. But that is not hapening. When i am going to the main page all the text boxes are getting cleared. Can you solve my problem please?:
how to reload form contents
Moderator: General Moderators
how to reload form contents
hi everybody,
I have a form that has several textfields. When i click a button the form gets submitted and a new page opens. When i get back to the main page i need to populate the textboxes automatically with the data that has initially been entered. But that is not hapening. When i am going to the main page all the text boxes are getting cleared. Can you solve my problem please?:

I have a form that has several textfields. When i click a button the form gets submitted and a new page opens. When i get back to the main page i need to populate the textboxes automatically with the data that has initially been entered. But that is not hapening. When i am going to the main page all the text boxes are getting cleared. Can you solve my problem please?:
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Use sessions or a cookie to save the data put in by the user and then just echo the data you saved.
Code: Select all
session_start();
$_SESSION["name"]=$_POST["nameUser"];
//check to see if $_POST["nameUser"] is null
echo "<input type='text' name='nameUser' value=" .$_SESSION["name"] ." />";
// the rest of the data is the same don' t worry about select or options
session_unset();