uttam_lavate Posted March 7, 2008 Share Posted March 7, 2008 pls help me for generating code to maintain sessions in our web site...and tell me about how to use the setcookie() function... thanks in advance... Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted March 7, 2008 Share Posted March 7, 2008 To maintain a session, make sure your calling session_start() at the top of every page. The manual tells/shows you how to use the setcookie() function. Quote Link to comment Share on other sites More sharing options...
rameshfaj Posted March 7, 2008 Share Posted March 7, 2008 For instance for session: session_start(); $_SESSIOn["test"]="testing";//this places the value testing in the session under the name test. you can retrieve this session value in any page that you visit after setting the session. You can retrieve the session value as shown below: $sessionvalue=$_SESSION["test"];//the variable $sessionvalue holds the value "testing". For cookies:you can use setcookie() function with some parameters which specify what is the cookie name,how long should it last and so on. 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.