The Sea King Posted March 15, 2008 Share Posted March 15, 2008 How do we make the value of the cookie change when will press submit? <?php setcookie("username", time()+3600);?><html><body><form action=''>Username: <input type="text" name="user"><br>Password:<input type="password" name"password"><br><input type="submit" value="Log in"></form><?phpif (isset($_COOKIE["username"])) echo "Welcome " . $_COOKIE["username"] . "!<br />";else echo "Welcome guest!<br />";?> Link to comment Share on other sites More sharing options...
zeeshan Posted March 15, 2008 Share Posted March 15, 2008 in the last line it should not be "welcome guest" instead it should be echo <?php welcome $username ?> this will show the username and the out put will be like this.Welcome the username will be shown Link to comment Share on other sites More sharing options...
The Sea King Posted March 15, 2008 Author Share Posted March 15, 2008 I meant to get the username from the username form... Link to comment Share on other sites More sharing options...
justsomeguy Posted March 15, 2008 Share Posted March 15, 2008 You're not using setcookie correctly, check the reference:http://www.php.net/manual/en/function.setcookie.php Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.