Help With Simple IF statement

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

It works perfect. I love it.

Now, heres another question. If I have two IP addresses I want to make different colors, How would I do that?

For example I would want 123.333.33.3 to be red background, and I would like 127.0.0.1 to Be green background. The IPs are just a example. I will replace them with the correct ones when I get the code working.


THANKS SO MUCH!!!!!!!!
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

A simple if statement

Code: Select all

echo '<tr';
if ($ip == '127.0.0.1') echo ' bgcolor=red';
elseif ($ip == '127.0.0.1') echo ' bgcolor=green';
echo '>';
Something along those lines.. I recommend you check for the existance of the ip address first though..
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

Thanks Alot!!!!
Post Reply