Registering an Array Variable with a Session
|
<?php session_start(); ?> <html> <head> <title>Registering an array variable with a session</title> </head> <body> <h1>Product Choice Page</h1> <?php if ( isset( $form_products ) ){ $products = $form_products; session_register( "products" ); print "<p>Your products have been registered!</p>"; } ?> <p>
<form method="POST"> <select name="form_products[]" multiple size=3> <option> A <option> B <option> C <option> D <option> E </select> </p><p> <input type="submit" value="choose"> </form> </p> <a href="AccessingSessionVariables.php">A content page</a> </body> </html>
<!-- AccessingSessionVariables.php <?php session_start(); print session_encode(); ?> <html> <head> <title>Accessing session variables</title> </head> <body> <h1>A Content Page</h1> <?php if ( isset( $products ) ) { print "<b>Your cart:</b><ol>n"; foreach ( $products as $p ) print "<li>$p"; print "</ol>"; } ?> </body> </html> -->
|
|
|
|
|
HTML code for linking to this page:
Related in same category :
-
|