[SOLVED] Loop problems
Posted: Thu Sep 30, 2004 9:19 pm
I have the following bit of code (which will eventually be used to construct some queries, but for the moment is just testing the correct data is being passed.
Everything seems to be working fine, however (currently 2 records being passed to the page with the code below) the last status doesn't get displayed. The $num gets displayed for each record, and the correct status for the first record gets displayed but not the 2nd one. Which is strange because if i substitute $status[$x] with $status[2] the 2nd record gets displayed, any help would be appreciated, thankyou.
Everything seems to be working fine, however (currently 2 records being passed to the page with the code below) the last status doesn't get displayed. The $num gets displayed for each record, and the correct status for the first record gets displayed but not the 2nd one. Which is strange because if i substitute $status[$x] with $status[2] the 2nd record gets displayed, any help would be appreciated, thankyou.
Code: Select all
<?php
$num = $_POST['number'];
for ($x = 0; $x < count($num); $x++) {
echo 'Num: '.$num[$x].'<br>';
$status = $_POST['status'.$num[$x].''];
echo 'Status: '.$status[$x].'<br>';
}
?>