Session preferences : _SESSION « Cookie Session « PHP






Session preferences

 
<?php  session_start();

  if($_POST['font'] != null)
  {  
    $_SESSION['font'] = $_POST['font'];
    header( "Location:prefs2.php?" . SID );
    exit();
  }
?>



<html>

 <head>
  <title>Session preferences</title>
 </head>

 <body>

  <h3>Select Your Preferred Font Family</h3>

  <form action = "<?php echo( $_SERVER['PHP_SELF'] ); ?>" method = "post">
   <input type = "radio" name = "font" value = "serif">Serif
   <input type = "radio" name = "font" value = "sans-serif">Sans
   <input type = "radio" name = "font" value = "monospace">Mono
   <input type = "radio" name = "font" value = "cursive">Cursive
   <input type = "radio" name = "font" value = "fantasy">Fantasy
   <br><br>
   <input type="submit" value="Submit">
  </form>

 </body>

</html>
  
  








Related examples in the same category

1.Count Visits with session
2.Counting page accesses with a session
3.Implementing Sessions
4.Printing session data
5.Registering a variable by including it in $_SESSION
6.Session based counter
7.Session using the proper $_SESSION super global
8.Verifying session info
9.check for a valid login in sessions
10.create_session_variable.php
11.delete_session_variable.php
12.Doing something special for a logged in user
13.Setting Up Cookie Authentication