Page 1 of 1

dynamic header

Posted: Wed Oct 15, 2003 6:22 am
by Consuelo
im creating a session variable
$HTTP_SESSION_VARS['page_name'] = "feedback"; in index.php

the user clicks Login and is directed to a page with a header
header(" Location: index.php");

however i want the user to go back to the file they logged in from
so the filename , which is now index needs to take on the value
of $HTTP_SESSION_VARS['page_name']

i tried this at a guess
header(" Location: " + $HTTP_SESSION_VARS['page_name'] + ".php");

and the error message was this
The server encountered an internal error or misconfiguration and was unable to complete your request

didnt think it would work but thought id try it
can anyone give me an idea please? thanks :)

Posted: Wed Oct 15, 2003 6:36 am
by Nay

Code: Select all

header(" Location: " + $HTTP_SESSION_VARSї'page_name'] + ".php");
:lol: This is not Javascript, it's PHP. Here's how you do it:

Code: Select all

$go = $_SESSION['page_name'] . ".php";
header("Location: $go");
-Nay

Posted: Wed Oct 15, 2003 9:15 pm
by Consuelo
thanks :)