Hello Jon,

Friday, January 16, 2004, 3:29:07 PM, you wrote:

JB> And after the form is submitted I assumed I could do this...

JB> $aListItems = array();

JB> $i = 1;

JB> while ($i <= $iListItems) {

JB>     $tempItem = $_POST["listItem" . $i];
JB>     array_push($aListItems, $tempItem);
JB>     ++$i;
JB> }

JB> print_r ($aListItems);

JB> but nothing appears to be added to the db, how can I access the $_POST
JB> vars within a loop ??

I can't see the whole script, so this is just guess work - but your
loop is checking to see if $i (1) is less than $iListItems, but as far
as I can see this isn't defined anywhere in your code, so the loop
will never actually go through because it's saying 1 <= 0.

Where is $iListItems set and to what value?

Your loop will work, but it's not obvious it's getting the chance to.

Also you don't need to array_push it, you could just do:

$aListItems[] = $tempItem;

-- 
Best regards,
 Richard                            mailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to