$_SERVER['HTTP_REFERER'] redirect...

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
User avatar
Todd_Z
Forum Regular
Posts: 708
Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan

$_SERVER['HTTP_REFERER'] redirect...

Post by Todd_Z »

How do I redirect the site based on the $_SERVER['HTTP_REFERER'] var? I assumed it was simply

Code: Select all

<?php
header("Location: ".$_SERVER['HTTP_REFERER']);
?>
But apparently I was wrong.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Are you trying to send someone back where they came from?
User avatar
Todd_Z
Forum Regular
Posts: 708
Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan

Post by Todd_Z »

Yea, after I change the style that they set... Follow up question... is there simply a way to add via hyperlink variables to the end of a string... like http://www.website.com/?page=Main ... then they click the link and it goes to everything already there plus &setStyle=Red?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Code: Select all

<?php
$url = $url . '&setStyle=Red';

?>
Is that what you mean?
User avatar
Todd_Z
Forum Regular
Posts: 708
Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan

Post by Todd_Z »

No, i mean something like <a href="&setStyle=Red">link</a>.... No php involved, can it be done someway?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

You can use javascript to change the css style sheet, which would allow you to change all the colors on a page with a link, if that is what you are trying to do.
Post Reply