Little help with a small piece of php

Discussion in 'PHP' started by wallarookiller, Feb 13, 2009.

  1. #1
    I've got the script working just fine I'm just not that great at php yet. What I need to do is simply have the script open up links in a new window when it calls it from the database. It works fine now but I mess something up when I simply add target="_blank" to the link. I get a sytax error that I'm sure is because I just need to add a stupid back slash or something.

    Heres the piece of code:
    
    $topics_html = '';
    while($topic = mysql_fetch_array($result))
    {
        $topics_html .= "<a href=\"{$path}viewtopic.php?t={$topic['topic_id']}\">{$topic['topic_title']}</a><br /><br />";
    }
    mysql_close($conid);
    
    echo $topics_html;
    ?> 
    
    Any help would be greatly appreciated :)
    
    
    Code (markup):

     
    wallarookiller, Feb 13, 2009 IP
  2. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #2
    Try using:

    target= '_blank' href

    and I don't think you will need to backslash the ' but you might. Try it without first.
     
    Colbyt, Feb 13, 2009 IP
    wallarookiller likes this.
  3. wallarookiller

    wallarookiller Active Member

    Messages:
    647
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Perfect I new it was easy. thanks man some green for you.
     
    wallarookiller, Feb 13, 2009 IP