ok, ive trawled through books, tried countless examples, but still cant get these bl**dy cookies to work, heres a example from a book, i've added a couple of extra lines, in some desparate attempt to get it working, please can someone help. Is my code complete twaddle, or is there something else im supposed to do?
setcookie.php
<?php
$user = $HTTP_POST_VARS['user']; //added myself
$colour = $HTTP_POST_VARS['colour']; //added myself
if (($user !=null) and ($colour !=null))
{
setcookie ("firstname", $user, time()+2592000);
setcookie ("fontcolour", $colour, time()+2592000);
header("Location:getcookie.php");
exit();
}
?>
<html><head><title> Set cookie Data</title></head><body>
<form action="<?php echo($PHP_SELF); ?>" method="post">
Please enter your first name:
<input type="text" name="user"><br><br>
Please choose your favourite font colour: <br>
<input type="radio" name="colour" value="#FF0000"> Red
<input type="radio" name="colour" value="#00FF00"> Green
<input type="radio" name="colour" value="#0000FF"> Blue
<br><br><input type="submit" value="submit">
</form>
</body></html>
getcookie.php
<?php
$fontcolour = $HTTP_POST_COOKIE['fontcolour']; //added myself
$firstname = $HTTP_POST_COOKIE['firstname']; //added myself
?>
<html>
<head>
<title>Get cookie Data</title>
<style type="text/css">
body { color: <?php echo ($fontcolour);?> }
</style></head>
<body><h1>Hello <?php echo ($firstname); ?>!</h1></body> </html>
please please can someone help me, or give me a couple of scripts that are dummy proof
ta
T