1<?php
2 // Start new or resume existing session.
3 session_start();
4
5 // Add values to the session.
6 $_SESSION['item_name'] = 'value'; // string
7 $_SESSION['item_name'] = 0; // int
8 $_SESSION['item_name'] = 0.0; // float
9
10 // Get session values.
11 $value = $_SESSION['item_name'];
12?>
1<?php
2 // Start the session
3 session_start();
4?>
5<!DOCTYPE html>
6<html>
7 <body>
8 <?php
9 // Set session variables
10 $_SESSION["color"]= "blue";
11 $_SESSION["animal"]= "dog";
12 echo "The session variable are set up.";
13 ?>
14 </body>
15</html>
1<?php
2 // Start the session
3 session_start();
4
5 // Set session variables
6 $_SESSION["color"]= "blue";
7 $_SESSION["animal"]= "dog";
8 echo "The session variable are set up.";
9?>
1<form action="login.php" method="post">
2Dein Name: <br />
3<input type="Text" name="name" />
4<input type="Submit" />
5</form>
6