Login form



PHP. FOR, WHILE, FOREACH Loops and inside operations, PART 2
Generate table:
<?

$tr = 11;

?><table cellpadding="0" cellspacing="0" align="center" valign="top" border="1"><?
for ($i=1; $i<$tr; $i++) {

?><tr><td>vienas tekstas</td><td>kitas tekstas</td></tr><?

}

?></table><br>

Generate table- two loops:
<?

$tr = 11;
$td = 11;

echo "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\" valign=\"top\" border=\"1\">";

for ($i=1; $i<$tr; $i++) {

echo "<tr>";

for ($j=1; $j<$td; $j++) {

echo "<td align = center>\$i <b>$i </b> , \$j <b>$j</b></td>" ;

}

echo "</tr>";

}

echo "</table>";

?>

Table with few styles, colors:
<?
$x = 'bgcolor="#AAAAAA" align="center" valign="middle" border="0"';
$y = 'bgcolor="#FFFFFF" align="left" valign="middle" border="0"';

$xx = 'color="#FFFFFF" face="times" size="3"';
$yy = 'color="#000000" face="helvetica" size="2"';
$tr = 11;

?><table width="100%" cellpadding="0" cellspacing="0"align="center" valign="top" border="1"><?

for ($i=1; $i<$tr; $i++) {

$tr_spec = ($i % 2) ? $x : $y;
$td_font = ($i % 2) ? $xx : $yy;
$td_font_reverse = ($i % 2) ? $yy : $xx;

?><tr <? echo $tr_spec; ?> >
<td><font  <?= $td_font ;?>Tekstas: <b><?= $td_font; ?></FONT></td>
<td><font  <?= $td_font_reverse ;?>Tekstas: <b><?= $td_font_reverse; ?></FONT></td>
</tr>
<?

}

?>
</table>
 
[ BBC news ][ Yahoo news ][ Linux guru ][ Webmaster ACE ]