Forum Moderators: coopster
<?php
session_cache_limiter('private');
$cache_limiter = session_cache_limiter();
session_cache_expire(45);
$cache_expire = session_cache_expire();
session_start();
$ids=$_SESSION['ids'];
$sql = mysql_query("DELETE FROM bookings WHERE id=$ids");
echo "test";
session_regenerate_id();
You could add an identifier in a hidden field in the form so that you know it's an identifier that's already been used - and hence this is a resubmit.
The way to purely detect a resubmit from a form is to give each form you hand out a unique id in it (hidden field is the easiest) and track which you handed out to whom and check if they get submitted twice.
One way to do this is to keep the number of changes low:
i.e. you help the user building up their choices, but you do not "reserve" anything till they are further along.
If that doesn't help you need to track the state the user is in in your session (do not drop it, that's not going to help you).
You have states and transition, and I'd for something that's making me think hard, would definitely draw up an actual state diagram (If unfamiliar: google for it, plenty of info out there)
[edited by: helenp at 10:15 am (utc) on May 24, 2013]
+------------+
----------------> |just looking|
create session +------------+
+------------+
----------------> |just looking|
create session +------------+
| ^
|___|
looks at property
not available after all
_____________________________
| |
v |
+------------+ +----------------+
----------------> |just looking|-----------------> | bookit pressed | -------------------------->
create session +------------+ book it pressed +----------------+ reserve for this session
| ^
|___|
looks at property
[edited by: swa66 at 10:21 am (utc) on May 24, 2013]
Now the user can just keep looking or he can look at all properties he wants: he stays in the just looking state.
Now the user can just keep looking or he can look at all properties he wants: he stays in the just looking state, see availability, enter his choice of rooms etc. You track those variables in your session. if the user goes back, they can change at will.