Page 1 of 1
Sessions or cookies
Posted: Thu Mar 27, 2003 11:45 am
by leebo
I have made a form which i want a user to only access once. I need some ideas on how i can do this.
I have a page which will post the info - form.php?user=ok
they can then fill out the form and press submit - however when you press the back button they go back to the form.php and it will let them back in and submit again - how can i stop them from submitting twice ? could i do this using cookies ? but what if the user has cookies disabled ?
HELP PLS

Posted: Thu Mar 27, 2003 1:23 pm
by pootergeist
sessions are your friend and really simple to use in recent builds - I strongly advise using them, they'd be perfect for that situation.
Posted: Thu Mar 27, 2003 1:39 pm
by leebo
So how would i do this ? i have tried using session but when the browser back button is clicked it some how doesn`t register without refreshing the page first ?
Can anyone help me solve this problem. Thanks
Posted: Thu Mar 27, 2003 2:16 pm
by daven
viewtopic.php?t=6521
Check out that sticky about sessions
Posted: Thu Mar 27, 2003 6:16 pm
by oldtimer
You can also put a refresh on that page.
When they hit submit the form processes' then refreshed to whatever page which in return goes to the page you really want them to see when they are done. I use this in logouts.
They click on Logout. It takes them to the logout page kills the session then uses the refresh to a new page and then there it uses the refresh in the header back to index or whatever. Hitting the back button will not take them back to the page they just submited from. I just make the delay 0 seconds.
sessions
Posted: Thu Mar 27, 2003 11:19 pm
by mattd
you should read that sticky..
do this:
if ($_SESSION['viewed_form'] == true)
{
echo "You already saw this!";
or
add refresh code
} else {
echo "put your form";
$_SESSION['viewed_form'] = true;
}