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

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 its working and calls the variable “folder”

Any suggestions how to do this?

If the information is coming in from the link then you can either use the $_GET global array to get each parameter which you appear to have tried.
You also have the option of $_SERVER[‘QUERY_STRING’] to get ALL the arguments.

How are you using the header() and in what context?