[SOLVED] formula loop problem
Posted: Sat Mar 26, 2005 2:21 pm
I'm a newbie to coding so I hope this is not an incredibly stupid question. I can't figure out why this loop isn't working.
$rarea is obviously an array (ie. bis, cbb, frr, ...)
I have a form which creates and populates additional arrays of selections based on values in $rarea, each one begins with "res_", for example "res_bis" would be one of the array names, or res_cbb,....
The loop runs once successfully, but does not move onto the next value of $rarea. I ran a loop to see if the other $rarea values were being passed:
and got a good/correct response, so what is wrong with the first for loop?
Any suggestions would be appreciated.
PS I apologize in advance if this code was not posted correctly. If so, please let me know what I did wrong.
Code: Select all
<?php
for ($i=0; $i < count($rarea); $i++) {
if ($rarea[$i] != "") {
echo $rarea[$i] . "<br>";
$_SESSION["res_" . $rarea[$i]] = $_POST["res_" . $rarea[$i]];
$res_spec = $_SESSION["res_" . $rarea[$i]];
for ($i=0; $i < count($res_spec); $i++) {
echo $res_spec[$i] . "<br>";
}
}
}
?>I have a form which creates and populates additional arrays of selections based on values in $rarea, each one begins with "res_", for example "res_bis" would be one of the array names, or res_cbb,....
The loop runs once successfully, but does not move onto the next value of $rarea. I ran a loop to see if the other $rarea values were being passed:
Code: Select all
<?php
for ($i=0; $i < count($rarea); $i++) {
echo $rarea[$i] . "<br>";
}?>Any suggestions would be appreciated.
PS I apologize in advance if this code was not posted correctly. If so, please let me know what I did wrong.