Bug linking to named anchor in php file

Discussion in 'PHP' started by cd27701, Mar 4, 2008.

  1. #1
    Apologies if this is a stupid question. I'm html-savvy but don't know php--but I have been tasked with updating a site built in php. I'm wondering if the syntax for linking to a named anchor tag is different in php than in html, and I haven't found anything looking through tutorials. Here's the problem I'm having:

    I have a .php page that includes named anchors, and a second page that links to the .php page at those anchor points. If I type in the url (http:www.site.com/page.php#anchor) in the browser, it goes exactly where it should. But if I click on the link from the second page, it goes to the anchor and then jumps to the bottom of the page. There is a form at the bottom of the page; don't know if that has anything to do with it.

    Any clue what's wrong?
     
    cd27701, Mar 4, 2008 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Firstly, you have to understand that PHP has nothing to do with what happens on the client's side (like anchors). PHP just generates the HTML and outputs it to the browser. What happens after that, is all HTML/CSS/Javascript.

    I'm not really sure if I understand what exactly the problem is, but maybe you have multiple anchors with the same name? I can only guess, though, without seeing your code.
     
    nico_swd, Mar 4, 2008 IP