Hi,
Is there a way to keep a variable using sessions even if the user closes the browser?
For example,
I'm trying to create a simple form where a user enters a name in a text box and submits it. The next page stores the variable. When I go back to the form page the box has the stored variable already in place, which is what I want. But, when I close the browser and go back to the page, the variable is gone. Is there a way to keep the variable stored in a session so it'll stay when a user reopens thier browser...kinda like a cookie? Heres the code im using:
PAGE1.PHP
<?php
session_start();
print '<form method="POST" action="PAGE2.PHP">
<font face="Arial">
<select size="1" name="employee">
<option>';
if (session_is_registered("employee")){
echo $employee;
}
print '</option>
<option>One 1</option>
<option>Two 2</option>
<option>Three 3</option>
</select><input type="submit" value="Page 2" name="B1"></p>
</form>';
?>
PAGE2.PHP
<?php
session_start();
session_register("employee");
print 'Value of \$employee is ';
echo $employee;
?>
Thanks a bunch! 😃