Re: Execute php with back button
- From: Lüpher Cypher <lupher.cypher@xxxxxxxxxxx>
- Date: Fri, 30 Dec 2005 05:12:18 GMT
zek2005 wrote:
I need that when the user goes back to the last page with the "Back" button of the browser, the page executes the php code again.
Is there any code to insert in php that implies a reload every time the page appears in the user browser??
Simply disable caching:
<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the pastsession_start();
if (!session_register("var")) {
session_register("var");
$_SESSION["var"] = 1;
} else {
$_SESSION["var"]++;
}echo $_SESSION["var"];
?>
This will output 1 on first load, Go to some other site, then hit back, and it will output 2 :)
luph .
- Follow-Ups:
- Re: Execute php with back button
- From: Tim Roberts
- Re: Execute php with back button
- References:
- Execute php with back button
- From: zek2005
- Execute php with back button
- Prev by Date: Listing objects
- Next by Date: Re: Users/permissions/files - LAMP
- Previous by thread: Execute php with back button
- Next by thread: Re: Execute php with back button
- Index(es):