Cookies can be an annoyance by themselves, especially if your User turns them off or disables JavaScript.
Are you trying to save the data when the User submits the form, or when he navigates away from your page?
If you just want to save the data when the User submits the form, all you have to do is store the User's input in the session --
[php]
foreach($_REQUEST as $key => $val)
if($key != 'PHPSESSID')
$_SESSION['form1data_or_whatever'][$key] = Validator::makeSafe($val);
[/php]
This assumes, of course, that you wrote a validator class to safe your input. If you didn't, you could use
validator.class.php .
Anyway, then on your HTML form:
-
<input name="email" type="text" value="<?php echo $_SESSION['form1data_or_whatever']['email']; ?>/>
-
Bonus points if you set up a Smarty tag instead!