This is an HTML question, but I'll answer it anyway :P. You need to apply an anchor to the content you want to scroll down to. Use the name attribute to set an anchor, #234 asks the browser to locate an element with the name #234. Your div will look something like this: <div id="234" name="234">. id and name can be two different values if required.
Thanks for the response, but I already have that done. If you look at my original post, my question pertains to how I can assign '234' to a php variable. Any thoughts??
Thanks, I'll do some testing with that. The reason I want the number is so I can use some javascript to highlight div that has the id/name 234. If you can think of a better way to do this, by all means -I'm all ears.
Anything after a hash or pound sign(anchors), is not sent to the server. They are used by the browser, and only after the page is loaded. If you want to pass a variable in the URL you prefix it with a question mark and use the $_GET array or $_SERVER['QUERY_STRING'].
Anything after a hash or pound sign(anchors), is not sent to the server. They are used by the browser, and only after the page is loaded. If you want to pass a variable in the URL you prefix it with a question mark and use the $_GET array or $_SERVER['QUERY_STRING'].
Very true, but in the OP's case he's wanting to capture the anchor point used. Technically speaking, he could use ?id=1234#1234 but he is not using the $_GET to collect any information or display information (to the best of my knowledge).
I Inigoesdr. Yes I am very familiar with passing variable via URL. It looks like I am going to have to combine both methods which will look somewhat stupid in the URL, but it seems to be the only way ex. http://www.mysite.com?id=234#234.
This way the page will automatically scroll to <div id=234> and I can assign id=234 to a variable in order to use in a query.
The problem is still the same though, hashes are not sent to the server for processing, so #234 would never be available for php to use.
In PHP, there is no way to retrieve the has from an input URL, as it is not included in any server variable. If you're talking about a string with a url in it, then you can use parse_url to retrieve the hash.
The hash itself I believe is still retrievable in Javascript anyways, since it is a client side language. So you can still use Javascript to highlight this id.