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'] . ""); ?> Link to comment https://forums.phpfreaks.com/topic/161295-syntax-help/ 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. Link to comment https://forums.phpfreaks.com/topic/161295-syntax-help/#findComment-851125 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? Link to comment https://forums.phpfreaks.com/topic/161295-syntax-help/#findComment-851128 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 Link to comment https://forums.phpfreaks.com/topic/161295-syntax-help/#findComment-851138 Share on other sites More sharing options...
Daniel0 Posted June 7, 2009 Share Posted June 7, 2009 Quote 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. Link to comment https://forums.phpfreaks.com/topic/161295-syntax-help/#findComment-851139 Share on other sites More sharing options...
justAnoob Posted June 7, 2009 Author Share Posted June 7, 2009 um, ok. Link to comment https://forums.phpfreaks.com/topic/161295-syntax-help/#findComment-851142 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. Link to comment https://forums.phpfreaks.com/topic/161295-syntax-help/#findComment-851178 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"); Link to comment https://forums.phpfreaks.com/topic/161295-syntax-help/#findComment-851183 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... Link to comment https://forums.phpfreaks.com/topic/161295-syntax-help/#findComment-851191 Share on other sites More sharing options...
Ken2k7 Posted June 7, 2009 Share Posted June 7, 2009 Ever used $_GET? Link to comment https://forums.phpfreaks.com/topic/161295-syntax-help/#findComment-851196 Share on other sites More sharing options...
justAnoob Posted June 8, 2009 Author Share Posted June 8, 2009 yes,,, how do you mean though? Link to comment https://forums.phpfreaks.com/topic/161295-syntax-help/#findComment-851322 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. Link to comment https://forums.phpfreaks.com/topic/161295-syntax-help/#findComment-851354 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. Link to comment https://forums.phpfreaks.com/topic/161295-syntax-help/#findComment-852045 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.