Forum Moderators: coopster

Message Too Old, No Replies

using for loops by Column and Row

looping..

         

nanat

9:36 am on Sep 10, 2009 (gmt 0)

10+ Year Member



how i can use for loops by using this statement sequences
RSDFG
A 11111
B 11111
C 11111
D 11111

$column = 5;
$row = 4;

Column:

for($r=0; $r < $column; $r++)
{
echo '<input type="text" size="6" name="inputValue[]">;
}


how about Row?

any idea? i really appreciate if u help me guys..

thanks..

omoutop

12:44 pm on Sep 10, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



try and play with this

for ($r=1; $r<=$row; $r++)
{
echo '<tr>';
for ($c=1; $c<=$column; $c++) { echo '<td>row'.$r.' - col'.$c.'</td>' }
echo '</tr>';
}

nanat

2:10 am on Sep 11, 2009 (gmt 0)

10+ Year Member



tnx for bro i solve it ^^

<?php
$row = 5;
$col = 4;
for ($r=1; $r<=$row; $r++)
{
echo '<tr>';
echo '<td><input type="text" size="6" name="row[]"></td>';

for ($c=1; $c <=$col; $c++)
{


echo'<td><input type="text" size="6" name="col[]"></td>';

}
echo '</tr>';
}
?>