lightlydone Posted February 28, 2011 Share Posted February 28, 2011 Hi All, I'm sending an email with a link to a web page with a form on. <tr style="padding:10px;"> <td align="center"> <a style="text-decoration:none;" href="http://www.foo.co.uk/bar.php?id=123"> <img src="/header.jpg" border="0" style="display: block;" width="380" height="64" alt="Logo" /> </a> </td> </tr> I currently GET the id from the URL and add it to a hidden field in the form which then sends the ID to the database on submit so I know from which email the user came from to fill out the form. This doesn't always work as I guess some people move from the form page to look at other pages on my site then come back to fill in the form. I think I need to use SESSION to keep the id 'active' but cannot figure out how to GET the id from the URL and put it into a SESSION, alas I am struggling to even start and finish a basic SESSION. Thanks in advance, Ben. Link to comment https://forums.phpfreaks.com/topic/229151-variable-from-email-link-to-session/ Share on other sites More sharing options...
AbraCadaver Posted February 28, 2011 Share Posted February 28, 2011 At the top of ALL pages you need: session_start(); Then on the bar.php you need: session_start(); if(!isset($_SESSION['id']) && isset($_GET['id'])) { //see if session id is not set and that get id is set $_SESSION['id'] = $_GET['id']; } Link to comment https://forums.phpfreaks.com/topic/229151-variable-from-email-link-to-session/#findComment-1180885 Share on other sites More sharing options...
lightlydone Posted February 28, 2011 Author Share Posted February 28, 2011 Thanks Shawn. Link to comment https://forums.phpfreaks.com/topic/229151-variable-from-email-link-to-session/#findComment-1180891 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.