dynamic header

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Consuelo
Forum Newbie
Posts: 4
Joined: Wed Oct 15, 2003 6:22 am

dynamic header

Post 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 :)
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post 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
Consuelo
Forum Newbie
Posts: 4
Joined: Wed Oct 15, 2003 6:22 am

Post by Consuelo »

thanks :)
Post Reply