Logic -- conditional statements
| From: | Ricardo Fitzgerald | Date: | Sun, 04 Jun 0102 00:40:26 +0000 |
| Subject: | Logic -- conditional statements | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-100527@lists.php.net to get a copy of this message | ||
Hi to all,
I'm trying to echo a neat table with values from a form, depending on
the values it echoes a table with one row with two or with three:
Then I have conditional nested statements, to validate these variables
and wrote the table with the proper values in each case, the problem
is the table is displayed 3 times instead of 1 each time it finds a
value TRUE!
I need it to display only once, I mean in the first instance the
table, has 1 row, the second 2 rows, the third 3 rows, and they are
independent.
The code is something like:
//Value1 is always 1
if ($value1 == 0)
{
exit
}
if ($value2 ==0)
{
echo // echoes the table
.
.
."<td ... >$variable1 ...
."<td ... >$variable2...
."<td ... >$variable3 ...
."<td ... >$variable4 ...
}
if($value2 == 0)
{
.
.
echo // echoes the table
.
.
."<td ... >$variable1 ...
."<td ... >$variable2...
."<td ... >$variable3 ...
."<td ... >$variable4 ...
."<tr> /next row
.
."<td ... >$variable5 ...
."<td ... >$variable6...
."<td ... >$variable7 ...
."<td ... >$variable8 ...
."</tr>
.
.
}
if($value3 == 3)
{
.
.
echo // echoes the table
.
.
."<td ... >$variable1 ...
."<td ... >$variable2...
."<td ... >$variable3 ...
."<td ... >$variable4 ...
."<tr> /next row
.
."<td ... >$variable5 ...
."<td ... >$variable6...
."<td ... >$variable7 ...
."<td ... >$variable8 ...
."</tr>
.
.
."<td ... >$variable9 ...
."<td ... >$variable10...
."<td ... >$variable11 ...
."<td ... >$variable12 ...
."</tr>
.
.
//and then closes the php script,
TIA
Regards,
Rick