-3

I am currently working on home.php where I have the following anchor link echo'd:

<a href='#?id=$thought_id' class='toggle-comment' data-id='$thought_id' style='padding-left: 5px;'> Comments ($num_of_comments) </a>            

Now, when I hover over the Comments anchor, I get the id of the thought fine. It's just that when I hover over the link, or when I click the link, the url reads:

http://localhost/home.php#?id=210 

So, 210 is the ID of the thought the comments anchor is assigned to, which works. But I do not understand why the file name is appending to the anchor link when it hasn't been defined to do so.

Even when I put <a href='#'> The URL still reads http://localhost/home.php#

Freddy
  • 683
  • 4
  • 35
  • 114
  • Possible duplicate of [HREF="" automatically adds to current page URL (in PHP). Can't figure it out](http://stackoverflow.com/questions/8764288/href-automatically-adds-to-current-page-url-in-php-cant-figure-it-out) – A.L Mar 30 '16 at 22:32

1 Answers1

0

Your browser is going to show you the full, canonical URL (including the anchor) when you hover over a link. It's the same link that will be copied to your clipboard if you right-click it and choose "Copy Link Location".

David White
  • 1,763
  • 2
  • 16
  • 27