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

    Spammers dont get more help by spamming.

      do u want to explain that last comment? 😕

        ok, guess not, i dont understand what you're saying, but seeing as it says you're a senior member, im sure my problem that im having with my final year project that has to be in in a few weeks would be a doddle to you, i wouldnt ask for help unless i really needed it,

        thanks

        T

          Write a Reply...