Private Label and Cobranded VoIP Solutions
BrainCast internet & phone based message/memo recording & reminder organization system
Internet Phone Service and Broadband Phone Service by ViaTalk

Go Back   VoIP Forums, Internet Phone Service Forums, & Web Hosting Forums > CoderForums - Programming Discussion > General Programming Issues > Programming Languages & Technologies > PHP

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-12-2002, 05:33 PM
Damian
Guest
 
Posts: n/a
Stupid PHP Question

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
Reply With Quote
  #2  
Old 01-12-2002, 09:35 PM
Damian
Guest
 
Posts: n/a
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
Reply With Quote
  #3  
Old 01-19-2002, 12:35 AM
alan92rttt alan92rttt is offline
Registered User
 
Join Date: Jan 2002
Posts: 12
Send a message via AIM to alan92rttt
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.
Reply With Quote
  #4  
Old 01-24-2002, 11:59 AM
Reaver's Avatar
Reaver Reaver is offline
is right behind you.
 
Join Date: Sep 2001
Location: BC, Canada
Posts: 118
Can you do the same thing with the printf command?
__________________
alextaylor.org
Reply With Quote
  #5  
Old 01-24-2002, 12:20 PM
sylow sylow is offline
PHP/MySQL Developer
 
Join Date: Jan 2001
Posts: 88
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
__________________
Gokhan ARLI
Freelancer for your Php/MySQL Projects
www.sylow.net

Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump