Hi there, I'm new to the IT industry. I will finish my bachelor's degree in a few weeks. I would like a little help on a small part of functionality I wish to include in my final project.

Basically I would like to send across a variable in the browser and retrieve it using the $_get function. I want to add a #name anchor to the end of the address so when the page loads, it loads to the bottom of the page whilst retrieving the relevant content that applies to the variable being sent through the address bar.
My code is similar to this structure:

$leftimg = '<a href="galleries.php?left='.$cl.'#imagenav"> <img src="../images/scrollleft.png" class="imgleft" alt=""/> </a>';
$rightimg = '<a href="galleries.php?right='.$cr.'#imagenav"> <img src="../images/scrollright.png" class="imgright" alt=""/> </a>';
<div id="imagenav"></div>
echo $leftimg;
echo $rightimg;

So when page loads It should go to bottom whilst passing the variable to that page. It works... kind of, I can get the variable fine and it loads dynamically and accordingly to the variable sent by retrieving it using the $_get function. But does not go to where "imagenav" is located.

I tried this by manually setting the variable $cr or $cl to a static value, the same thing happened, however when I clicked it a second time, the page focused to the bottom of the screen where "imagenav" is located (obviously the page content remained the same the second time around it was clicked).

Any help is appreciated. Also i'm new here, so if in wrong forum please redirect me.