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=\"http://filesharingtalk.com/index.php\" target=\"_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 \ 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 $message; ?></td>
</tr>
</table>
Hope this helps. Best thing for you to do is download the PHP documentation from www.php.net.
Or you could use single quotes without escaping, and concentacating things like line breaks and tabs (single quotes don't accept any escaped characters except for \').
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're trying to do...
echo <<<HTML
Put a <i>string</i> with...
<blockquote>HTML code</blockquote>
...in <q>here</q>.
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 "<b>hello world</b>"; and
print("<b>hello world</b>");
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 "<b>hello world</b>";
and
print("<b>hello world</b>");
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
Heredoc will break on some crappy hosts. 1&1 is an example.
Powered by vBulletin® Version 4.2.3 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.