Hey, this must be my like 5th post today!
I'm trying to link to another page, and i need a variable insie the href= and i cant seem to do it. Im trying ot put it inside a echo ' '; that contains other lines of HTML code to, but i cant seem to get $session to show the session id. instead PHP puts the link out like login3.php?$session and thats not how i want it, i want the session id, i have $session assigned with session_id(); so its not that.
I've tried other things too but thsoe have failed. How do i fo it?
Thanks,
Limb
Linking with variables
Moderator: General Moderators
I'm going to guess you are doing echo'' (with single quotes) and not echo"" with double quotes. if that is the case, then you need to understand that the variable is not converted to its value with the single quotes....you'll need to do string concatenation.... here are two possible solutions...
a good article on the subject can be found at http://www.webmasterbase.com/article/686
Code: Select all
//use single quotes, and concatenate (preferred)
echo 'login3.php?'.$session;
//use double quotes
echo "login3.php?$session";