Jump to content

header() syntax help


SN1P3R_85

Recommended Posts

I posted about this earlier today, and i think i went about explaining my problem the wrong way. I want to redirect one of my pages to a another page, but i stored the location in a variable. On a previous page i stored the url by doing this:

 

$_SESSION['return_url'] = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];

 

Now after the user does something, it should redirect them back to that page. I am not sure how to include the variable in the location. I've tried this, and it doesn't redirect at all.

 

$url = $_SESSION['return_url']; 

header("Location: $url");

 

Basically, i just need to know how to use a variable instead of a direct url. Also, if you know a better way to store a url than this, go ahead and tell me:

 

$_SESSION['return_url'] = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];

Link to comment
https://forums.phpfreaks.com/topic/122454-header-syntax-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.