justAnoob Posted June 7, 2009 Share Posted June 7, 2009 I'm working on retrieving the url and store it as a session so I can call it back with a header statement... Does this look right??? <?php $_SESSION['url'] = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; header("" . $_SESSION['url'] . ""); ?> Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted June 7, 2009 Share Posted June 7, 2009 You need session_start at the top if you don't already have it. Then go here - http://us3.php.net/manual/en/function.header.php - and you'll find out what you left out in your header parameter. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted June 7, 2009 Share Posted June 7, 2009 I might also want to add that doing "" . $_SESSION['url'] . "" is completely redundant. You're appending and prepending empty strings? Quote Link to comment Share on other sites More sharing options...
justAnoob Posted June 7, 2009 Author Share Posted June 7, 2009 still having probs... how would you go about getting this url and saving it as a variable to pull later on. Â http://www.mysite.com/mypage.php?pageno=2 Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted June 7, 2009 Share Posted June 7, 2009 still having probs... Â Okay, now I know exactly what's wrong, and fortunately I know the solution as well: Wave your magic wand three times in a counter-clockwise direction while shouting your name backwards. Quote Link to comment Share on other sites More sharing options...
justAnoob Posted June 7, 2009 Author Share Posted June 7, 2009 um, ok. Quote Link to comment Share on other sites More sharing options...
thebadbad Posted June 7, 2009 Share Posted June 7, 2009 Did it actually work? Â ... Â What Daniel is trying to get at, is that you should describe what's wrong, post the relevant code and any errors. And if you don't know how to put a string into a variable, I would recommend you learn that and other similar basics before going any further. Quote Link to comment Share on other sites More sharing options...
justAnoob Posted June 7, 2009 Author Share Posted June 7, 2009 http://ww23.rr.com/index.php?origURL=http://http//www.mysite.com/mypage.php That is what page I return with the following code below. I don't want all that,, just http//www.mysite.com/mypage.php  It is also leaving out the page number.. Any ideas??  $_SESSION['url'] = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];  $url = $_SESSION['url']; header("Location: http://$url"); Quote Link to comment Share on other sites More sharing options...
justAnoob Posted June 7, 2009 Author Share Posted June 7, 2009 Ok,, here is my setup now... and yes,, i use session_start Lets say this is what is in the url box http://www.mysite.com/mypage.php?pageno=2  I use this to get what is in the url box $_SESSION['getpage'] = $_SERVER['HTTP_REFERER']; I even echoed out that out to see what I get,, and it is the entire address in the url box.  Then when I use this header,, it leaves out the page number and I get this... http://www.mysite.com/mypage.php  $getpage = $_SESSION['getpage']; header("Location: $getpage"); exit();  Any input would be appreciated. Thanks... Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted June 7, 2009 Share Posted June 7, 2009 Ever used $_GET? Quote Link to comment Share on other sites More sharing options...
justAnoob Posted June 8, 2009 Author Share Posted June 8, 2009 yes,,, how do you mean though? Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted June 8, 2009 Share Posted June 8, 2009 What do you mean what do I mean? You can get the data you want with $_GET['var_name']. Of course, you change var_name to the argument you want to get. If you don't fully understand how to use $_GET, then Google it. It's not hard. php.net probably has many examples. Generally I would put up an example, but for something like this, which I consider things people should already know (PHP 101), I don't. Quote Link to comment Share on other sites More sharing options...
justAnoob Posted June 9, 2009 Author Share Posted June 9, 2009 I have been trying for a while now.. And still nothing... I looked everywhere on google and stuff... Still can't get a grip on how to do this... Even talked to a few people that are looking for the same thing. 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.