SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member iftieaq's Avatar
    Join Date
    Nov 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Help Need :(

    Hello, I am a new PHP learner. Is there any way to use HTML ( Especially HTML Hyperlink ) code in PHP echo statement ?

    Example -

    <?php
    echo "visit <a href="http://www.sitepoint.com/forums/">SitePoint Forum</a>";
    ?>


    But this code is not working

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,215
    Mentioned
    457 Post(s)
    Tagged
    8 Thread(s)
    The problem is that you are using double quotes around the echo statement and also within it, so PHP gets confused about where the statment ends. It sees this as the echo statement:

    PHP Code:
    "visit <a href=" 
    ... and then wonders what all the other rubbish is ...

    You have various options here, such as:

    Code:
    'visit <a href="http://www.sitepoint.com/forums/">SitePoint Forum</a>';
    "visit <a href='http://www.sitepoint.com/forums/'>SitePoint Forum</a>";
    "visit <a href=\"http://www.sitepoint.com/forums/\">SitePoint Forum</a>";
    There first one is probably the best.

  3. #3
    SitePoint Member iftieaq's Avatar
    Join Date
    Nov 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Many many thanks for your fast reply. It's working now. Thanks again


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
  •