1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to embed <a href=" tag into php echo ?

Discussion in 'PHP' started by cri8bat, Jul 28, 2011.

  1. #1
    Hi all,

    I am using dreamweaver and deploying urls from database, however I want they to be <a href=" dyanamic url"> dynamic url</a>

    with dreamweaver the code appears like this:

    <p><?php echo $row_Recordset1['url']; ?></p>

    the $row_Recordset1['url']; is the dynamic url from databse, how do I make them as href???

    for example

    <a href=" url1"> url1</a>
     
    cri8bat, Jul 28, 2011 IP
  2. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #2
    You can use exactly what you have above.

    <p><a href="<?php echo $row_Recordset1['url']; ?>"><?php echo $row_Recordset1['url']; ?></a></p>
    PHP:
    If you are doing this from a database result set (i.,e more than one row) you just need to loop over the results using the same syntax.

    You might want to actually look into giving it a title="" tag and proper anchor text however.
     
    lukeg32, Jul 28, 2011 IP
  3. cri8bat

    cri8bat Well-Known Member

    Messages:
    1,459
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    160
    #3
    it does work!

    thank you

     
    cri8bat, Jul 28, 2011 IP