PDA

View Full Version : Html In Php



Hunted
04-09-2004, 05:26 PM
How do I put HTML code in PHP?

Nogimics
04-09-2004, 07:01 PM
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.

h1
04-10-2004, 02:34 AM
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;).

Cl1mh4224rd
04-14-2004, 12:34 PM
You might find Heredoc (http://us2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc) to be useful, depending on what you&#39;re trying to do...


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;

vivitron 15
04-14-2004, 03:35 PM
one thing thats had me confused somewhat is: is there a difference (besides looking different) between
echo &#34;&#60;b&#62;hello world&#60;/b&#62;&#34;; and
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

Cl1mh4224rd
04-14-2004, 09:11 PM
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

echo &#34;&#60;b&#62;hello world&#60;/b&#62;&#34;;
and

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? (http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40)

vivitron 15
04-14-2004, 10:10 PM
cool cheers - its bugged me (only a little) for a while now :)

CoolMac
04-15-2004, 01:58 AM
it is easyier to just close php and start html and do it over...and over...and over

h1
04-15-2004, 03:04 AM
Heredoc will break on some crappy hosts. 1&1 is an example.