Page 1 of 1

Need to be pointed in the right direction...

Posted: Sun May 11, 2003 2:16 pm
by jsvela
Hello, all!

I'm new to php and could use some assistance. I'm not sure what board this question should be on, so I'm starting here with the hope someone will tell me which board I should be on.

I have an assignment that I was told would probably be best handled with PHP and MySQL.

What I'm looking to do is this:

I have some excel webpages that are going to contain information such as: Alert Status=0, Alert Status=1, Alert Status=2

0=Green
1=Yellow
2=Red

What I need to do, however, is get a way for a webpage to call the correct image to another page depending on what the value of a cell is in the excel spreadsheet: 0, 1, or 2.

main.asp (or main.php) needs to have images called dependent upon the value of a given cell in the waittimeslink.htm page. And the waittimeslink.htm page is a page that needs to be viewable, too.
----------------------------------------------------------------------------------
If the value of cell "S10=2" (in waittimeslink.htm) then a red image needs to be displayed on main.asp (or main.php)

If the value of cell "S10=1" (in waittimeslink.htm) then a yellow image needs to be displayed on main.asp (or main.php)

If the value of cell "S10=0" (in waittimeslink.htm) then a green image needs to be displayed on main.asp (or main.php)
----------------------------------------------------------------------------------

As I mentioned before I'm new to php, but I'm not looking for the "here's how you do that! it's so easy!" response (not that I'd mind that kind of help) but I want to learn how to do it, too.

I'm sure this post belongs on another board, but I'm not sure which one, so if someone would be kind enough to point me in the right direction I'd be very appreciative.

Thanks!

Jason

Posted: Sun May 11, 2003 2:19 pm
by twigletmac
I've popped this into the PHP forum.

Mac

Thanks!

Posted: Sun May 11, 2003 2:27 pm
by jsvela
That was fast! Thank you for putting my post in the correct place.

Jason

Posted: Sun May 11, 2003 6:15 pm
by Coco
well you can use if statements or switch statements depending on how many different cases there are (switch for more, if for less)

ie:

Code: Select all

<?php
if($status==0)
   echo '<img src=green.gif>';
if($status==1)
   echo '<img src=yellow.gif>';
if($status==2)
   echo '<img src=red.gif>';


//switch

switch($status)
{
   case(0):
   echo '<img src=green.gif>';
   break;
   case(1):
   echo '<img src=yellow.gif>';
   break;
   case(2):
   echo '<img src=red.gif>';
   break;
   //etc etc
}

?>
check out the php manual to see what it has to say about control functions

As to how to get the data from the cell..... not too sure myself, never tried to integrate excel into html :/