Jump to content

syntax help


justAnoob

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.