Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Question about use of "if()" statement...
Old 02-06-2009, 05:14 PM Question about use of "if()" statement...
Junior Talker

Posts: 2
Trades: 0
Hello

I'm very new to php and this is my first post...

If I understand the various tutorials correctly (no guarantee!), I think I can use html code after the "if" and "else" statements (as opposed to something like "echo")? If this is correct, is there a particular trick to getting the html code to run???

TIA

Andrew
AndrewS is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-06-2009, 05:33 PM Re: Question about use of "if()" statement...
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
No Trick. Just drop in and out of the PHP interpreter
PHP Code:
<?php if (condition) { ?>
<h1>True</h1>
<?php } else { ?>
<h1>False</h1>
<?php }; ?>
However using echo() to send out the HTML as a string can be little cheaper on server CPU resources.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-06-2009, 06:59 PM Re: Question about use of "if()" statement...
Junior Talker

Posts: 2
Trades: 0
Chris

Many thanks for the quick and useful reply - it was dropping out and back in to php that I was missing.

Thanks again

Andrew
AndrewS is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Question about use of "if()" statement...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12349 seconds with 12 queries