Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    May 2006
    Posts
    1,674
    Thanks
    28
    Thanked 4 Times in 4 Posts

    How do I quote html on my php page ?

    Hi,

    I am building my page with PHP and on one of my pages I need to
    show some html code that can be copy and pasted by the client.

    For example, this is my code:

    PHP Code:
    while ($row_prod mysql_fetch_assoc($result_prod)) {
    $D_name "{$row_prod['prod_name']}";
    $D_code "{$row_prod['code']}";
    $D_id "SF649"."{$row_prod['prod_id']}";
    echo 
    "<tr><td width = \"140px\">$D_name</td></td><td width = \"400px\">
    [B]
    <!-- //SF-Code--$D_name--$D_code--// --> 
    <a href=\"http://www.my-site.com/check.php?key=$D_id\" 
    onclick=\"NewWindow(this.href,'','800','600','yes','default'); return false\" 
    onfocus=\"this.blur()\" >
    <img src=\"http://www.my-site.com/image_load.php?id=$sup_id\" 
    alt=\"Click to Verify - Before you Buy\" 
    border=\"0\" >
    </a>
    [/B]
    </td><td></td></tr>"
    ;
    // end while 
    Now all the code that is between the bold tags is for copying and pasting.

    The problem is that if I just place it as it is, I get a clickable image
    which is what the client should have on his website.

    How do I de-activate this code so I just get the code showing ?

    Thanks
    Last edited by jeddi; 09-02-2009 at 04:02 PM.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    You need to escape the html coding. Use &lt; and &gt; to escape the < and > and that should pretty much do it.

  • #3
    Senior Coder
    Join Date
    May 2006
    Posts
    1,674
    Thanks
    28
    Thanked 4 Times in 4 Posts
    Thanks,

    That worked out fine


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •