Hi!,
I am having a strange problem with my code. Basically the counter $_SESSION['total_number'] decrements each time the browser refresh button is pressed, even if the 'Click to download' link has not been pressed. How do I stop this from happening?. The counter should only change if 'Click to download' is pressed and then the browser refresh button. Here is the code:
<?php
error_reporting(E_ALL);
session_start();
if( !isset($SESSION['total_number']) ) {
$SESSION['total_number'] = 3; // store session data
}
$test1 = "myfile.pdf";
$test2 = "John Doe";
if ( $test2 ) {
echo ("$test2");
echo ("<td><font face = \"Verdana\" size = \"2\"><a href=\"samofile.php?arg1=$test1\">Click to download.[/url]</font></td>");
echo "Downloads left = ". $SESSION['total_number'];//retrieve data
$SESSION['total_number']--;
} else {
echo ("$test2");
echo ("downloads complete");
}
?>
Thanks for your time!