I have written 3 pages to test how session variables should work. First page, use a loop to add 5 to a session variable, the next page does the same, and the third page is to display the value of the session varialbe, but it is blank the first time it is run and displays the correct answer the 2nd time it is run. Am I missing something?
billtest.php
<?php
session_start();
$_SESSION['alpha']=1;
While($SESSION['alpha']<=5)
{
$SESSION['alpha']++;
}
header("Location: /billtest2.php");
?>
billtest2.php
<?php
session_start();
While($SESSION['alpha']<=10)
{
$SESSION['alpha']++;
}
header("Location: /billtest3.php");
?>
billtest3.php
<?php
session_start();
echo "Hi this page is number 3 <br />";
echo "The Session is " . $_SESSION['alpha'] . "<br />";
exit;
?>
Thanks for any assistance in advance,
Bill