ok iv got a form, with a username and password input, i want to turn the username into a cookie, i found the script for this, but it doesnt seem to work. here it is:
[code=php]
<?php
if (!isset($_COOKIE[‘user’])) {
setcookie(“user”, $_POST[‘user’], time() + 3600);
}
?>
//and the form…
<html>
<body>
<form method=”post” action=”login.php” onsubmit=”return validate_form(this)”>
Username: <input name=”user” type=”text”><br />
Password: <input name=”password” type=”password”><br />
<input type=”submit” value=”Sign in”> <input type=”Reset”>
</form>
</body>
</html>
Don’t worry about validation or anything like that, iv got it all sorted, i just need to turn it into a cookie.
Here is the page where i want to display the cookie, but this works when i set the cookie normally, so it should work
[code=php]
<html>
<body>
<?php
echo “Welcome ” . $_COOKIE[“user”] . “!<br />”;
?>
</body>
</html>
thanks