What is the PHP equivalent of <a href>?

Discussion in 'PHP' started by Devilfish, Nov 24, 2008.

  1. #1
    Hi folks,

    Can someone tell me what the php equivalent of <a href=""></a> is please?

    Thanks :)
     
    Devilfish, Nov 24, 2008 IP
  2. GreatMetro

    GreatMetro Peon

    Messages:
    117
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    There is no equivalent. HTML and PHP are two separate things. You can redirect in PHP via a header() call, but that's not an anchor link.
     
    GreatMetro, Nov 24, 2008 IP
  3. drew22299

    drew22299 Guest

    Messages:
    76
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    PHP is a scripting language whereas html is used to format pages. But you can use the <a href with PHP, for example

    <?php

    echo "<a href='url'>your link here</a>";

    ?>

    Or if you want to redirect the user to another page using PHP

    <?php

    header('Location: http://www.website.com/');

    ?>
     
    drew22299, Nov 25, 2008 IP
  4. Devilfish

    Devilfish Active Member

    Messages:
    396
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    70
    #4
    Thanks for the replies, I'm learning as I go! :)

    This is what I was trying to do...

    echo "Google = <a href='http://www.google.com/search?hl=en&lr=&ie=UTF-8&q=link:".$url."&filter=0' target='_blank'>".google_backlink($url)."</a><br />";
    PHP:
     
    Devilfish, Nov 25, 2008 IP
  5. cipals15

    cipals15 Well-Known Member

    Messages:
    1,085
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    100
    #5
    PHP 101 is the first tutorial i have ever read about php. And as you go on, you realize something is missing. You need MySQL to further increase the power of php.
     
    cipals15, Nov 25, 2008 IP
  6. kallell

    kallell Peon

    Messages:
    94
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    $Google = "<a href='http://www.google.com/search?hl=en&lr=&ie=UTF-8&q=link:".$url."&filter=0' target='_blank'>".google_backlink($url)."</a><br />";

    Then to call it later:

    echo $Google;
     
    kallell, Nov 25, 2008 IP