izildop Posted March 5, 2016 Share Posted March 5, 2016 So I need a page that holds a cookie name and will tell you how much times this cookie name is visited. So I got this for the form. So lets say I type in the form the name Paul, next time if I type Paul again the cookie will say, hello paul you have visited this page 3 times depenting ofcourse how much time he as visited already. If I will type another name like Bob, it will say, Hello bob you have visited this page 1 time. Somebody can help with this ty. <?php echo "naam:<input type=\"text\" name=\"name\" size=\"20\"><br/>"; echo "<input type=\"submit\" value=\"Verzenden\" />"; ?> Quote Link to comment Share on other sites More sharing options...
Destramic Posted March 5, 2016 Share Posted March 5, 2016 (edited) ok firstly you would need to set a cookie for the page your talking about....here is a example setcookie ('time_visited', time(), 3600, '/' , 'domain.com', true, false); when revisiting this page again you can do something like this: if (isset($_COOKIE['time_visited'])) { $time_visited = $_COOKIE['time_visited']; $last_visited = date('m/d/Y H:i:s', $time_visited); echo "Hi User, you last visited: " . $last_visted; } you may want to look at the manuel here regarding cookies: http://php.net/manual/en/function.setcookie.php i hope this is what you are looking for Edited March 5, 2016 by Destramic Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted March 6, 2016 Share Posted March 6, 2016 Just for the record a user can delete a cookie file or gets deleted when closing browser. If is something you want to control and not the client use session Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.