Page 1 of 1

if clause in ShowInfo ?

Posted: Tue Nov 22, 2005 4:02 pm
by daan
can i post an if clause in a ShowInfo ?

Code: Select all

$ShowInfo = "<table border=0 align=center width=\"100%\">\n\t<tr>\n\t
    <td width=\"60%\" valign=top><font size=3 face=verdana color=black>
    <b>$a1[first], $a1[second], $a1[third]</b></font><br>
    <font size=2 face=verdana color=black>$a1[fourth]</font></td>\n\t
    <td width=\"40%\" valign=top align=center>
    <font size=2 face=verdana><B>something<br>
               if($a1[condition] == 'y')
	       {
	        $ShowInfo .= "<img src=\"imageyouwanttodisplayifconditionismet.gif\" alt=\"Image\"><br>\n";
	       }
";
the problem is, if i don't post the if clause in the ShowInfo then the image appears on the top of my page and not where i want it to be, how can i solve this?

Posted: Tue Nov 22, 2005 4:27 pm
by Charles256
break out of your show info.do your if statement, and if it passes add that information to show info the dot operator. i.e.

$ShowInfo .= I believe, might be =. , heh.

edit: I'm jsut trying to give you a hint in the right direction, if you get really stuck lemme know and I could be persuaded to make it crystal clear.

Posted: Tue Nov 22, 2005 5:01 pm
by hawleyjr

Code: Select all

$ShowInfo = "<table border=0 align=center width=\"100%\">\n\t<tr>\n\t
    <td width=\"60%\" valign=top><font size=3 face=verdana color=black>
    <b>$a1[first], $a1[second], $a1[third]</b></font><br>
    <font size=2 face=verdana color=black>$a1[fourth]</font></td>\n\t
    <td width=\"40%\" valign=top align=center>
    <font size=2 face=verdana><B>something<br>";
    
               if($a1[condition] == 'y')
           {
            $ShowInfo .= "<img src=\"imageyouwanttodisplayifconditionismet.gif\" alt=\"Image\"><br>\n";
           }
           
//OR:

$ShowInfo = "<table border=0 align=center width=\"100%\">\n\t<tr>\n\t
    <td width=\"60%\" valign=top><font size=3 face=verdana color=black>
    <b>$a1[first], $a1[second], $a1[third]</b></font><br>
    <font size=2 face=verdana color=black>$a1[fourth]</font></td>\n\t
    <td width=\"40%\" valign=top align=center>
    <font size=2 face=verdana><B>something<br>" . ($a1[condition] == 'y'?"<img src=\"imageyouwanttodisplayifconditionismet.gif\" alt=\"Image\"><br>\n":'');

Posted: Tue Nov 22, 2005 5:25 pm
by Charles256
bah.your no fun..showing the code and all... :-D

Posted: Tue Nov 22, 2005 5:31 pm
by hawleyjr
Charles256 wrote:bah.your no fun..showing the code and all... :-D
Guess I'm just here to help people :roll:

Posted: Tue Nov 22, 2005 6:00 pm
by Charles256
bah.just different ways of skinning the same cat... :-D