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. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    There isn't one, PHP will execute a script

    to start and end a PHP script you need this

    
    <?php <-- start
    
    // code
    
    ?> -- end
    
    Code (markup):
     
    EricBruggema, Nov 28, 2008 IP
  3. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #3
    They are totally different.

    You can output/print <a href=""></a> using print() function in php

    print '<a href=""></a>';
    PHP:
     
    ads2help, Nov 28, 2008 IP
  4. Affix

    Affix Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    you can also use echo

    
    <?php
    
    echo "<a href=\"http://YOURSITEHERE.COM\">TITLE</title>";
    
    ?>
    
    PHP:
     
    Affix, Nov 28, 2008 IP
  5. JamieH

    JamieH Well-Known Member

    Messages:
    975
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    140
    Digital Goods:
    1
    Articles:
    1
    #5
    or you could just use the <?php start tag and ?> end tag when necessary, like this:

    
    <?php echo 'What a beautiful day'; ?>
    
    <a href="index.php">Home</a>
    
    <?php echo 'Another script here'; ?>
    
    PHP:
     
    JamieH, Nov 28, 2008 IP
  6. Jake-Johnson

    Jake-Johnson Peon

    Messages:
    839
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I know you can only use JS and HTML in the <a></a> tags. No others.

    
    <a onclick="alert('You have clicked this link!');">Click here</a>
    
    Code (markup):
    Or

    
    <a href="#">Click here</a>
    
    Code (markup):
    Hope it helped.
     
    Jake-Johnson, Nov 28, 2008 IP