DLR Posted January 15, 2007 Share Posted January 15, 2007 Hi all. I want people to be free to browse my site for information - and only provide their name if they want to log in (there is no benefit to the viewer for this, other than having one's name on the pages).I would like the index page to welcome them automatically (i.e without signing in) each time eg. "Hello [color=red]David [/color] (name from cookie), welcome back". So I need to set cookies.However I want to encourage them to sign up for my newsletter. I want to make the site friendly and I want to have the signup page automatically insert the name from the cookie, into the form <input type ="text" value=" <?php echo $_COOKIE('name'); ?> ">I know this can be done - this forum does it when I open the page - but how?This has got me beat!Any guidance will be most welcome!Thank you Link to comment https://forums.phpfreaks.com/topic/34302-saving-cookie-information-in-sessions/ Share on other sites More sharing options...
Orio Posted January 15, 2007 Share Posted January 15, 2007 Should be:[code]<input type ="text" value=" <?php echo $_COOKIE['name']; ?> ">[/code]Orio. Link to comment https://forums.phpfreaks.com/topic/34302-saving-cookie-information-in-sessions/#findComment-161337 Share on other sites More sharing options...
DLR Posted January 15, 2007 Author Share Posted January 15, 2007 Hi Orio,Thanks for the feedback. Does this mean that a cookie value can be saved in this way?How can do that? Do we have session_start() at top of page - if so, how do we automatically call up the cookie?Thanks Link to comment https://forums.phpfreaks.com/topic/34302-saving-cookie-information-in-sessions/#findComment-161357 Share on other sites More sharing options...
Orio Posted January 15, 2007 Share Posted January 15, 2007 If you want to set a cookie, use setcookie().All of the cookies' values are available using the $_COOKIE super-global array, just like I showed you in my previous post- $_COOKIE['the_cookie_name'].Orio. Link to comment https://forums.phpfreaks.com/topic/34302-saving-cookie-information-in-sessions/#findComment-161369 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.