"first_page.php" file:
<?php
session_start(); //start the session
if(isset($_POST["textfield"])) //if you post the form with the value textfield
$_SESSION["my_var"]=stripslashes($_POST["textfield"]);
//clear the \ signs from the posted text... and set the session variable with that, called my_var
?>
<form name="form" method="post" action="?">
<?php
if(isset($_SESSION["my_var"])) //if this session variable has a value, lets print another textfield...
print 'Your text<input type="text" name="textfield" value="'.$_SESSION["my_var"].'">';
else
print 'Type a variable<input type="text" name="textfield" value="">'; //in that case, the session has'nt got a value.
?>
<input type="submit" name="Submit" value="Submit"> </form>
<a href="anpther_page.php"> LEts see this session variable...</a>
on "anpther_page.php" file,
<?php
if(isset($_SESSION["my_var"]))
print 'Your text is:"'.$_SESSION["my_var"];
else
print '<a href="first_page.php"> LEts set a variable in this page: first_page.php .</a>';
?>