My boss asked something very specific: a page.php that will take one argument, and display text based on that argument + when the page is displayed scroll to an anchor on the page based on that argument.
How is that possible.
If I use argument ?a=1 the php can handle it, but how can the browser/javascript?
If I use anchor #a1 the browser can handle it, but I was unable to read this with php. I used:
$_SERVER["REQUEST_URI"]
Any creative solutions to this problem?
The window.location object contains what you need. cf. this: http://davidwalsh.name/javascript-window-location
The Hash is not seen by PHP, because the browsers don’t send it to the server. They are normally used the jump to a specific location in the page.