Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

How to use a variable in the “header Location” link?

php header location

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1 GertK

GertK

    CC Newcomer

  • Member
  • PipPip
  • 19 posts

Posted 16 January 2014 - 12:15 AM

I need to have a variable in my "header / Location" link. It should get the info from the link:

galleries.php?id=320&folder=rass

I have treid this:

header("Location: galleries.php?folder=".$_ARRAY["folder"]."");
header("Location: galleries.php?folder=".$_GET["folder"]."");
header("Location: galleries.php?folder="<?=$array["folder"]?>");
header("Location: galleries.php?folder=".$array["folder"]);
header("Location: galleries.php?folder=$array['folder']");

But nothing Works. I need to use the below create the correct link:

<?=$array["folder"]?>

If I in the HTML codes make a link like:

galleries.php?folder=<?=$array["folder"]?>

Then it’s working and calls the variable “folder”

 

Any suggestions how to do this?



#2 Alexander

Alexander

    YOL9

  • Moderator
  • 3963 posts

Posted 16 January 2014 - 10:00 AM

I do not understand your intention.

If the header works, you are simply looping endlessly:

1. url entered, GET data: folder=foobar
2. redirect to url + GET data: folder=foobar
3. goto: step 1.

This is just a basic observation based on the little you have given us on what your goal is.

If the browser does not halt the looping requests, and your script does perform as intended with the same folder name without the ID, then your browser may not be sending the headers. Please turn error reporting to maximum or review the error logs for evidence of this (read our FAQ in this section to learn how to do so.

Alexander.

All new problems require investigation, and so if errors are problems, try to learn as much as you can and report back.





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download