if clause in ShowInfo ?

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

Post Reply
daan
Forum Commoner
Posts: 25
Joined: Wed Nov 16, 2005 10:32 am

if clause in ShowInfo ?

Post 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?
Charles256
DevNet Resident
Posts: 1375
Joined: Fri Sep 16, 2005 9:06 pm

Post 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.
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post 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":'');
Charles256
DevNet Resident
Posts: 1375
Joined: Fri Sep 16, 2005 9:06 pm

Post by Charles256 »

bah.your no fun..showing the code and all... :-D
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Charles256 wrote:bah.your no fun..showing the code and all... :-D
Guess I'm just here to help people :roll:
Charles256
DevNet Resident
Posts: 1375
Joined: Fri Sep 16, 2005 9:06 pm

Post by Charles256 »

bah.just different ways of skinning the same cat... :-D
Post Reply