<HTML>
<HEAD>
<TITLE>Setting Prefs</TITLE>
</HEAD>
<?
if (!$body_color) {
$body_color = "#FFFFFF";
}
if (!$text_color) {
$text_color = "#000000";
}
?>
<BODY BGCOLOR="<? echo "$body_color"; ?>" TEXT="<? echo "$text_color"; ?>">
<H1>Your Preferences Have Been Set</h1>
<P>As you can see, your BODY color is now <strong><? echo "$body_color"; ?></strong> and your TEXT color is now <strong><? echo "$text_color"; ?></strong>.</p>
<P>If you now feel your color selections are atrocious, please feel free to <a href="session01.php">change your preferences</a>.</p>
</BODY>
</HTML>
The entire session02.php script should look something like this:
<blockquote>
<pre>
<font color="#009900" size="3">
<?
// File name: session02.php
// if a session does not yet exist for this user, start one
session_start();
if (!$PHPSESSID) {
session_register('body_color');
session_register('text_color');
} else if ((!$body_color) || (!$text_color)) {
session_register('body_color');
session_register('text_color');
}
// do something w/ POST vars
$body_color = $sel_body_color;
$text_color = $sel_text_color;
?>
<HTML>
<HEAD>
<TITLE>Setting Prefs</TITLE>
</HEAD>
<?
if (!$body_color) {
$body_color = "#FFFFFF";
}
if (!$text_color) {
$text_color = "#000000";
}
?>
<BODY BGCOLOR="<? echo "$body_color"; ?>" TEXT="<? echo "$text_color"; ?>">
<H1>Your Preferences Have Been Set</h1>
<P>As you can see, your BODY color is now <strong><? echo "$body_color"; ?></strong> and your TEXT color is now <strong><? echo "$text_color"; ?></strong>.</p>
<P>If you now feel your color selections are atrocious, please feel free to <a href="session01.php">change your preferences</a>.</p>
</BODY>
</HTML>