I created a process for leaving ads. So, in every step user leaves some of his data (his name in first, his interests in second, etc...). With hidden field with name 'step' I propagate to to the next step (eq. in function step1() I set step=2, in step2() hidden element step is set to 3, etc...)
I have the following problem:
when user forgots to fill some of the required fields, I generate an error and ask the user to hit back button to corect his mistake. So when the user hit back button, browser says that the page has expired. How can I avoid this problem?
The proces is next:
---- script.php ---------
class object{};
$ad = new object;
session_start();
session_register("ad");
switch($HTTP_POST_VARS["step"])
{
case 1: step1(): break;
case 2: step2(): break;
}
step1()
{
echo "<FORM METHOD=POST ACTION=\"$PHP_SELF\">
<INPUT TYPE=\"hidden\" NAME=\"step\" VALUE=\"2\">
<INPUT TYPE=\"hidden\" NAME=\"PHPSESSID\" VALUE=\"" . session_id() ."\">
--- here goes some of the information I request (name, email...)
<INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Continue\">
</FORM>";
}
step2()
{
if (step2_is_ok())
{
$ad->email = $HTTP_POST_VARS["email"];
$ad->name = $HTTP_POST_VARS["name"];
$ad-> etc...
// here goes another form...
// same as before
}else
{
echo "error..... hit back button";
}
}
regards,
coyote