Forum Moderators: coopster
this my for statement
if(isset($_POST["SQuery"]))
{$value = count($_POST["packTy"]);value 2
$production = count($_POST["production"]);input type value 16$x = 8;
for($y=0; $y<$value; $y++)
{
$PackTye = $_POST["packTy"][$y];for($i=0; $i<$x; $i++)
{echo '<table>';
echo '<tr>';
$production = $_POST["production"][$i];
$days = $_POST["days"][$i];
$location = $_POST["location"][$i];echo '<td>'.$production.'--</td>';
echo '<td>'.$days.'--</td>';
echo '<td>'.$location .'--</td>';
echo '<td>'.$PackTye.'';
echo '</tr>';
echo '</table>';}
}
if($production == $x)
{
$y = $x;}
else
{
$x = $x + 8;
}
}}
then i change it to do while looping
if(isset($_POST["SQuery"]))
{$value = count($_POST["packTy"]);
$production = count($_POST["production"]);$x = 8;
$i=0;
$y=0;
while ($y<$value)
{$PackTye = $_POST["packTy"][$y];
while ($i < $x )
{
echo '<table>';
echo '<tr>';
$production = $_POST["production"][$i];
$days = $_POST["days"][$i];
$location = $_POST["location"][$i];echo '<td>'.$production.'--</td>';
echo '<td>'.$days.'--</td>';
echo '<td>'.$location .'--</td>';
echo '<td>'.$PackTye.'';
echo '</tr>';
echo '</table>';$i++;
}
if($production == $x)
{
$y = $x;}
else
{
$x = $x + 8;
}
$y++;
}}
two input loops
this code run smoothly but when i 1st input sequentially to '8'
then 2nd input sequentially to '9' this codes only return the 1st input '8' but 2nd input 9 vanishes..
and i tried 7 and 8 combination it works fine.. so weird T_T..
i thought for loops and do while loops are the same but i was wrong because of this differences
$y=0;
while ($y<$value)
{
$y++
}
for($y=0; $y<$value; $y++)
[edited by: coopster at 12:25 pm (utc) on Oct. 28, 2009]
Thanks