Your Ad Here Your Ad Here
Results 1 to 9 of 9

Thread: Html In Php

  1. #1
    Poster
    Join Date
    Sep 2003
    Location
    Look behind you, you may not see me, but I am there
    Posts
    421
    How do I put HTML code in PHP?

  2. Internet, Programming and Graphics   -   #2
    You can Echo HTML within PHP like so:

    echo "<a href=&#092;"http://filesharingtalk.com/index.php&#092;" target=&#092;"_blank">filesharingtalk.com</a>";

    However you must notice that I used quotation marks within quotation marks and when yo do this in PHP you must Escape those quotation marks with a &#092; slash.

    However if you have a large amount of HTML it sometimes best to just Exit PHP and if needed put your PHP inside the HTML like so:

    <table>
    <tr>
    <td><?php echo &#036;message; ?></td>
    </tr>
    </table>

    Hope this helps. Best thing for you to do is download the PHP documentation from www.php.net.

  3. Internet, Programming and Graphics   -   #3
    h1
    Guest
    Or you could use single quotes without escaping, and concentacating things like line breaks and tabs (single quotes don&#39;t accept any escaped characters except for &#092;&#39.

  4. Internet, Programming and Graphics   -   #4
    Poster
    Join Date
    Jan 2003
    Location
    Belle Vernon, PA, USA
    Posts
    644
    You might find Heredoc to be useful, depending on what you&#39;re trying to do...

    Code:
    echo &#60;&#60;&#60;HTML
    Put a &#60;i&#62;string&#60;/i&#62; with...
    &#60;blockquote&#62;HTML code&#60;/blockquote&#62;
    ...in &#60;q&#62;here&#60;/q&#62;.
    HTML;

  5. Internet, Programming and Graphics   -   #5
    vivitron 15's Avatar Poster
    Join Date
    Jan 2003
    Location
    North East England, UK
    Posts
    1,772
    one thing thats had me confused somewhat is: is there a difference (besides looking different) between
    Code:
    echo &#34;&#60;b&#62;hello world&#60;/b&#62;&#34;;
    and
    Code:
    print&#40;&#34;&#60;b&#62;hello world&#60;/b&#62;&#34;&#41;;
    just cos i usually use print, but whenever i see code its usually with echo
    <insert signature here>

  6. Internet, Programming and Graphics   -   #6
    Poster
    Join Date
    Jan 2003
    Location
    Belle Vernon, PA, USA
    Posts
    644
    Originally posted by vivitron 15@14 April 2004 - 10:35
    one thing thats had me confused somewhat is: is there a difference (besides looking different) between
    Code:
    echo &#34;&#60;b&#62;hello world&#60;/b&#62;&#34;;
    and
    Code:
    print&#40;&#34;&#60;b&#62;hello world&#60;/b&#62;&#34;&#41;;
    just cos i usually use print, but whenever i see code its usually with echo
    Not a whole lot. What is the difference between echo and print?

  7. Internet, Programming and Graphics   -   #7
    vivitron 15's Avatar Poster
    Join Date
    Jan 2003
    Location
    North East England, UK
    Posts
    1,772
    cool cheers - its bugged me (only a little) for a while now
    <insert signature here>

  8. Internet, Programming and Graphics   -   #8
    Poster
    Join Date
    Oct 2003
    Location
    Montevideo,Uruguay
    Posts
    989
    it is easyier to just close php and start html and do it over...and over...and over

  9. Internet, Programming and Graphics   -   #9
    h1
    Guest
    Heredoc will break on some crappy hosts. 1&1 is an example.

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
  •