Reputation: 66697
I've a php page that refreshes every minute and on it an php array global variable that I use to compare values (before and after a page refresh).
But I've a problem, whenever the page is refreshed, the php array is resetted. I know that's because HTML is stateless but I want to mantain the state of this array.
How can I do that?
Upvotes: 0
Views: 1286
Reputation: 10192
You're looking for sessions http://www.php.net/manual/en/book.session.php
<?php
session_start();
if (!isset($_SESSION['arr']['counter'])) {
$SESSION['arr']['counter'] = 0;
} else {
$SESSION['arr']['counter']++;
}
var_dump($_SESSION);
?>
Upvotes: 3