setcookie returns false
Posted: Sun Nov 30, 2003 2:51 am
I cannot figure out why I can't set a cookie here. I don't think it's a problem with the server because usually I CAN set cookies when I copy paste other people's code, but when I change it to mine it simply does not work. Thanks in advance!
here is the html for a page called checkclass.html:
<html>
<body>
<form action="checkclass.php" method="POST">
Enter the SLN: <input type="text" name="sln" /><BR>
Enter the year: <input type="text" name="year" /><BR>
Enter the quarter: <input type="text" name="quarter" /><BR><BR>
<input type="submit" /><BR><BR>
</form>
</body>
</html>
and the relevant code from checkclass.php
Every single time setcookie returns false. Am I not allowed to use arrays in cookies? I have reason to believe that is not the problem, though I may be wrong. Thanks.
here is the html for a page called checkclass.html:
<html>
<body>
<form action="checkclass.php" method="POST">
Enter the SLN: <input type="text" name="sln" /><BR>
Enter the year: <input type="text" name="year" /><BR>
Enter the quarter: <input type="text" name="quarter" /><BR><BR>
<input type="submit" /><BR><BR>
</form>
</body>
</html>
and the relevant code from checkclass.php
Code: Select all
<?php
$theray = array($_POST["quarter"], $_POST["sln"], $_POST["year"]);
if (!setcookie("cooky", $theray)) /*, time()+36000))*/
echo "failed to set cookie";
?>