当用户在第一页上点击后退按钮会话变量时,我在会话中设置了值
if(isset($_SESSION['Seats']))
{
$Eventid = $_SESSION['Eventid'];
$stmt = $con->prepare(
'UPDATE fistevent SET `Status`=" " where `Event_Id`=? AND `seats`=? AND `Status`="Hold" '
);
$stmt->bind_param(
"st",$_SESSION['Eventid'],
$_SESSION['Seats']
);
$stmt->execute();
session_destroy();
session_unset();
}
这些值来自其他页面,通过POST方法
if(isset($_POST['EventId']))
{
$Price=mysqli_real_escape_string($con,$_POST['Price']);
$TicketType=mysqli_real_escape_string($con,$_POST['TicketType']);
$EventId=mysqli_real_escape_string($con,$_POST['EventId']);
}
$stmt = $con->prepare("select * from fistevent WHERE row_name LIKE 'A%'");
$stmt->bind_param("s", $_POST['EventId']);
$stmt->execute();
$result = $stmt->get_result();
$numRows = $result->num_rows;
if($numRows > 0) {
echo '<ul id="sub" class="sub">';
while($r = $result->fetch_assoc()) {
**displaying vlaues here came from database**
}
else
{
echo "No seats Available";
}
答案 0 :(得分:1)
考虑浏览器缓存。
后退按钮加载页面的缓存版本。
尝试使用此代码进行设置,可能对您有所帮助
<?php
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache");
?>