View Full Version : Stupid PHP Question
Damian
01-12-2002, 05:33 PM
Here's a stupid question for everyone regarding php.
I've got an if statement that needs to print out different messages based on the result of the statement.
What I'd like to do is format (color, font, etc) the printed statement, but print() won't let me put any html in the line.
Any ideas?
D
Damian
01-12-2002, 09:35 PM
Found out the answer to my question. The issue was the parentheses that I was trying to use for the html commands within the print statement. You have to escape the parentheses using a slash.
Here's an example:
print "<font=\"bold\">Hello world</font>";
D
alan92rttt
01-19-2002, 12:35 AM
keep in mind you can hop back and forth between HTML and PHP at will so you could do:
------------------------------------------------------------
<?php
$lcMyvar="hello World";
?>
<font="bold"><?php echo $lcMyvar ?></font>
------------------------------------------------------------
I did not have to use a varriable for this but, its is probably closer to what you want.
Also the ' is different from " the following would also work
------------------------------------------------------------
print '<font="bold">Hello world</font>';
------------------------------------------------------------
Anything between ' ' is not evaluated strings between " " are.
Reaver
01-24-2002, 11:59 AM
Can you do the same thing with the printf command?
sylow
01-24-2002, 12:20 PM
there is no question stupid, everybody started from somewhere.
Did you check tutorials about PHP? also you can get best PHP help from www.php.net
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.