NogDog,
I did put a "/" in the fourth parameter but that doesn't changes things.
Since no one else responded, let me re-post what my problem is...
There are 3 scripts in my PHP book:
1.) 0903_Customize.php
Allows you to set background color and font color by setting cookies.
2.) 0902_ViewSettings.php
Allows you to view the new settings.
3.) 0904_Reset.php
Allows you to re-set the background color to white and font color to black.
When I run the first script and select new colors, Firefox doesn't prompt me to accept/reject the cookies. And they do not appear in Firefox afterwards.
When I run the second script, the colors do seem to change.
When I run the third script, it re-sets the colors, but when I go back to the second script via hyperlink, the non-standard colors reappear, which leads me to belive there is a cookie issue.
Besides, why can't I find the cookies?
Here are my scripts...
0903_Customize.php
<?php
// Address eroor handling.
// error_reporting(E_ALL & ~E_NOTICE);
// Cookies have not been sent.
$cookies = FALSE;
// Handle the form if it has been sent.
if (isset($_POST['submit'])) {
// Send the cookies.
setcookie ('bg_color', $_POST['bg_color'],
time()+10000000, '/', '', 0);
setcookie ('font_color', $_POST['font_color'],
time()+10000000, '/', '', 0);
// Cookie have been sent.
$cookies = TRUE;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<?php
// If the cookies were sent, then print a message.
if ($cookies) {
print '<p>Your settings have been entered.
Click <a href="0902_ViewSettings.php">here</a>
to go back to the main page.</p>';
}
?>
<p>Use this form to set your preferences:</p>
<form action="0901_Customize.php" method="post">
<select name="bg_color">
<option value="">Background Color</option>
<option value="#ffffff">White</option>
<option value="#00cc00">Green</option>
<option value="#0000ff">Blue</option>
<option value="#ffff33">Yellow</option>
<option value="#cc0000">Red</option>
<option value="#000000">Black</option>
<option value="#111111">Other</option>
</select>
<select name="font_color">
<option value="">Font Color</option>
<option value="#ffffff">White</option>
<option value="#00cc00">Green</option>
<option value="#0000ff">Blue</option>
<option value="#ffff33">Yellow</option>
<option value="#cc0000">Red</option>
<option value="#000000">Black</option>
<option value="#111111">Other</option>
</select>
<input type="submit" name="submit" value="Set My Preferences" />
</form>
</body>
</html>
0902_ViewSettings.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<style type="text/css">
body {
<?php
// Address eroor handling.
// error_reporting(E_ALL & ~E_NOTICE);
// Check for a bg_color value.
if (isset($_COOKIE['bg_color'])) {
print "\tbackground-color: {$_COOKIE['bg_color']};\n";
} else {
print "\tbackground-color: #ffffff;\n";
}
// Check for a font_color value.
if (isset($_COOKIE['font_color'])) {
print "\t\t\t\tcolor: {$_COOKIE['font_color']}; \n";
} else {
print "\t\t\t\tcolor: #000000; \n";
}
?>
}
</style>
</head>
<body>
<p><a href="0904_Reset.php">Reset Your Settings</a></p>
<p>
yadda yadda yadda yadda yadda<br />
yadda yadda yadda yadda yadda<br />
yadda yadda yadda yadda yadda<br />
yadda yadda yadda yadda yadda<br />
yadda yadda yadda yadda yadda<br />
</p>
</body>
</html>
0904_Reset.php
<?php
// Address eroor handling.
// error_reporting(E_ALL & ~E_NOTICE);
// Delete the cookies.
setcookie ('bg_color', '', time()-60, '/', '', 0);
setcookie ('font_color', '', time()-60, '/', '', 0);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<p>Your settings have been reset!
Click <a href="0902_ViewSettings.php">here</a>
to go back to the main page.</p>
</body>
</html>
I'm not sure what is wrong, but sure could use some help!
Thanks,
Amy