Canman2005 Posted March 3, 2006 Share Posted March 3, 2006 Hi allI have a simple script which produces a code for me on the homepage, the php I use is[code]srand(time());$rand1 = (rand()%99999);$rand2 = chr(rand(ord("a"), ord("z")));$date = date("dmY");$code = "$rand1$rand2$date";[/code]I then print the code using[code]<?php print "$code"; ?>[/code]How can I retain this code and print it on any page that the user goes to? Even if they return to the homepage, how can I keep the code without it being replaced with a new one?How could I also create a page to delete the code so the user can get a new code when they return to the homepage.Any help would be greatThanks in advance everyoneEd Quote Link to comment Share on other sites More sharing options...
wickning1 Posted March 3, 2006 Share Posted March 3, 2006 You can store it in a cookie or put "?code=$code" after all of your links.Sessions are a way of storing lots of persistent information using a cookie or a variable on every link. PHP can automate the process somewhat. You can look into that as well. 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.