ted_chou12 Posted January 6, 2007 Share Posted January 6, 2007 $_SESSION["mailto"] = $to;$_SESSION["mailsubject"] = $subject;Is it? if not why cant I get them, they always appear blank when I do echo...Ted Quote Link to comment https://forums.phpfreaks.com/topic/33073-is-setting-the-session-like-this-correct/ Share on other sites More sharing options...
.josh Posted January 6, 2007 Share Posted January 6, 2007 your script needs to start with session_start(); Quote Link to comment https://forums.phpfreaks.com/topic/33073-is-setting-the-session-like-this-correct/#findComment-154113 Share on other sites More sharing options...
ted_chou12 Posted January 6, 2007 Author Share Posted January 6, 2007 Is it same when you echo, or you just have to put it where you set it?They are on 2 different pages Quote Link to comment https://forums.phpfreaks.com/topic/33073-is-setting-the-session-like-this-correct/#findComment-154114 Share on other sites More sharing options...
corbin Posted January 6, 2007 Share Posted January 6, 2007 To have data in $_SESSION session_start must be on the page, so yes, it must be on the echo page. Quote Link to comment https://forums.phpfreaks.com/topic/33073-is-setting-the-session-like-this-correct/#findComment-154116 Share on other sites More sharing options...
.josh Posted January 6, 2007 Share Posted January 6, 2007 just put session_start(); at the beginning of your script. It tells php that you have a session going on (or to start one, if you don't). [code]<?php session_start(); $_SESSION['blah'] = 'something'; echo $_SESSION['blah']; // output: something?>[/code]you need to have session_start(); on every page you wish to access your session varsif it is still echoing out nothing, then I would check your $to and $subject to see if they are holding what you are expecting them to hold. Quote Link to comment https://forums.phpfreaks.com/topic/33073-is-setting-the-session-like-this-correct/#findComment-154117 Share on other sites More sharing options...
ted_chou12 Posted January 6, 2007 Author Share Posted January 6, 2007 still wouldnt work, does session start have to be on top of every page? I did put them on the top, but still wouldnt work... Quote Link to comment https://forums.phpfreaks.com/topic/33073-is-setting-the-session-like-this-correct/#findComment-154528 Share on other sites More sharing options...
ted_chou12 Posted January 6, 2007 Author Share Posted January 6, 2007 can session be passed through two different host servers? I think thats the problem...I remember session is stored in the temporary folder of your host, so it cannot be passed to another server, is that right? Quote Link to comment https://forums.phpfreaks.com/topic/33073-is-setting-the-session-like-this-correct/#findComment-154533 Share on other sites More sharing options...
.josh Posted January 7, 2007 Share Posted January 7, 2007 okay first you say it's on another page, now you say it's on another server? If you expect results, try starting with non-vague questions/descriptions.no, you cannot pass a session from one server to another. Well actually, you can, but I have a sneaking suspicion that that circumstance does not apply to you. So no. Quote Link to comment https://forums.phpfreaks.com/topic/33073-is-setting-the-session-like-this-correct/#findComment-154889 Share on other sites More sharing options...
TEENFRONT Posted January 7, 2007 Share Posted January 7, 2007 does it need to be a session? perhaps you could wack the session vars from server 1, into a get/post request for server 2? then once server 2 has the vars, set them as a session on server2?whatever.. lol Quote Link to comment https://forums.phpfreaks.com/topic/33073-is-setting-the-session-like-this-correct/#findComment-154933 Share on other sites More sharing options...
ted_chou12 Posted January 7, 2007 Author Share Posted January 7, 2007 that sounds like a cool idea :P Quote Link to comment https://forums.phpfreaks.com/topic/33073-is-setting-the-session-like-this-correct/#findComment-154943 Share on other sites More sharing options...
weknowtheworld Posted January 7, 2007 Share Posted January 7, 2007 You can use cookies too.. Quote Link to comment https://forums.phpfreaks.com/topic/33073-is-setting-the-session-like-this-correct/#findComment-154982 Share on other sites More sharing options...
trq Posted January 7, 2007 Share Posted January 7, 2007 [quote]You can use cookies too..[/quote]Not accross domains you can't. Quote Link to comment https://forums.phpfreaks.com/topic/33073-is-setting-the-session-like-this-correct/#findComment-154984 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.