SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    May 2006
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Really need href assistance please

    Hello, I have a text link inside some php. Problem is I need it to do two things with the href. The first is to id the web address itseld when the link is clicked on.
    ?id=5
    The second is to id a location on the page, so that when the link is clicked on, it will jump down to another location on the page. #5
    Html shows that you can use location links in php. Is there a way I can use two hrefs somehow in one A link, or is there a way I can get the page location to work without putting it into a href?......
    Here's the code:

    PHP Code:
    <?php $links "";
    $links .= "<a id='c5' href='?id=5' href='#c5' ><span>test</span></a><br />";
    if (
    $_GET['id'] == 5)
    {
    $links .= "<h2 name='c5'><a href='http://www.anotherpagesomewhere'><span>test2</span></a></h2>";}
    echo 
    $link
    ?>
    I need some ideas so I can utilize both these features that are needed. Please let me know, thank you very much.

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    have you tried:
    PHP Code:
    $links .= "<a id='c5' href='?id=5#c5' ><span>test</span></a><br />"
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    SitePoint Addict
    Join Date
    May 2006
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Holy Mackeral, that worked, great job! I thought with the page id first it wouldn't find it. Don't have anything to send you, I send you all the links I had before but thanks so much for always being so helpful, you're very smart. Jen


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •