Page 1 of 1

Extracting anchor from url

Posted: Thu Jun 23, 2005 9:10 am
by hessodreamy
I have a page with a bunch of anchor tags. eg:

Code: Select all

<a name=&quote;tag1&quote;>
some text
<a name=&quote;tag2&quote;>
some more text
(In case you didn't know what anchor tags looked like!)

What I want to do is write to the database when a particular anchor is requested. So for

Code: Select all

<a href=&quote;page.php#tag1&quote;>
We just go to the tag. But for

Code: Select all

<a href=&quote;page.php#tag2&quote;>
We write to the database as well.

How do I do this? The # in the url doesn't seem to be available to $_REQUEST and suchlike, nor to the $_SERVER variables.
Any ideas?

Posted: Thu Jun 23, 2005 9:22 am
by CoderGoblin
Isn't it supposed to use id rather than name ?

Code: Select all

<a id=&quote;tag1&quote;>some text</a>
<a id=&quote;tag2&quote;>some more text</a>
Anyways my understanding that a page request to the server is not sent to the db with a # link. As such there is not way to do it using a pure PHP method. You may want to add javascript and possible use the HttpRequest methodology as described in Burrito's XMLHttp tutorial (who's online example)topic