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
daan
Forum Commoner
Posts: 25 Joined: Wed Nov 16, 2005 10:32 am
Post
by daan » Tue Nov 22, 2005 4:02 pm
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 » Tue Nov 22, 2005 4:27 pm
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.
hawleyjr
BeerMod
Posts: 2170 Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA
Post
by hawleyjr » Tue Nov 22, 2005 5:01 pm
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 » Tue Nov 22, 2005 5:25 pm
bah.your no fun..showing the code and all...
hawleyjr
BeerMod
Posts: 2170 Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA
Post
by hawleyjr » Tue Nov 22, 2005 5:31 pm
Charles256 wrote: bah.your no fun..showing the code and all...
Guess I'm just here to help people
Charles256
DevNet Resident
Posts: 1375 Joined: Fri Sep 16, 2005 9:06 pm
Post
by Charles256 » Tue Nov 22, 2005 6:00 pm
bah.just different ways of skinning the same cat...