tedd's SESSION Demo (Page 1)

This adds one to a variable and stores that value in a SESSION.

Session var = 0

session_id() = 8mtfevvs6pi4f8bbtoc5k44v53


GOTO Page 2
 

CODE FOLLOWS

<?php
    session_name
("sperlt");
    
session_start();
    
    include(
'includes/header.php');

    
// code
    
error_reporting(E_ALL);    // set error reporting to all
    
$var = isset($_SESSION['var']) ? $_SESSION['var'] : 0
?>
                        

        <h1>tedd's SESSION Demo (Page 1)</h1> 

        <p> 
            This adds one to a variable and stores that value in a SESSION. 
        </p> 
     
        <?php 
         
        
echo("Session var = $var");
         
        
$var++; 
        
$_SESSION['var'] = $var
         
        echo(
'<p>session_id() = ' session_id() . '</p>'); 
         
        
?> 

        <form action="session-page2.php" method="post" >      
            <input type="submit" value="GOTO Page 2"> 
        </form> 
        <br>
        <a href="session-page2.php">GOTO Page 2</a>
        
<?php

            
    
include('includes/footer.php');
?>