Mega Code Archive

 
Categories / Php / Cookie Session
 

Accessing Session Variables

<?php session_start(); ?> <html> <head> <title>Accessing Session Elements</title> </head> <body> <div> <h1>A Content Page</h1> <?php if ( is_array( $_SESSION['products'] ) ) {   print "<b>Your cart:</b><ol>\n";   foreach ( $_SESSION['products'] as $p ) {     print "<li>$p</li>";   }   print "</ol>"; } ?> <a href="indec.php">Back to product choice page</a> </div> </body> </html>