RE: [PHP] need help w a for loop

2003-10-20 Thread Ray Hunter
> > Or you could try this: > > > > $categories_array = array(); > > > > for( $j = 0; $j < $categories_count; $j++ ) { > > $tempval = "str_categories".$j; > > $categories[$j] = $_REQUEST[$tempval]; > > } > > Or you could get really fancy and try this (my preferred method if not a > little con

RE: [PHP] need help w a for loop

2003-10-20 Thread Chris W. Parker
Ray Hunter on Monday, October 20, 2003 2:47 PM said: > Or you could try this: > > $categories_array = array(); > > for( $j = 0; $j < $categories_count; $j++ ) { > $tempval = "str_categories".$j; > $categories[$j] = $_REQUEST[$tempval]; > } Or you could get rea

Re: [PHP] need help w a for loop

2003-10-20 Thread Ray Hunter
On Mon, 2003-10-20 at 15:35, Colin Kettenacker wrote: > $categories_array = array(); > for($j=0; $j < $categories_count; $j++){ > $tempval="str_categories".$j; > array_push($categories_array,$_REQUEST[$tempval]); > } Or you could try this: $categories_array = array(); for( $j = 0; $j < $categor

Re: [PHP] need help w a for loop

2003-10-20 Thread Redmond Militante
hi i've changed my loop to for($j=0; $j < $categories_count; $j++){ $categories_array = array(); $tempval="str_categories".$j; array_push($categories_array,$_REQUEST[$tempval]); } echo $categories_array[0]; //echoes nothing (should be a string value that was +previously at $_REQUEST['

Re: [PHP] need help w a for loop

2003-10-20 Thread Colin Kettenacker
Hi Redmond, A couple of issues I see here. First of all you are resetting the $categories_array to an empty array for each iteration in the loop. You must move it out of the loop. Secondly, you have enclosed the entire $_REQUEST superglobal variable in quotes so it is seeing it as a string rather

RE: [PHP] need help w a for loop

2003-10-20 Thread Chris W. Parker
Chris W. Parker <> on Monday, October 20, 2003 2:27 PM said: > that's because you've got: > >> array_push($categories_array,'$_REQUEST['.$tempval.']'); > > and not: > >> array_push($categories_array,$_REQUEST[$tempval]); Oh maybe I should explain why your original line wasn't working. You

RE: [PHP] need help w a for loop

2003-10-20 Thread Chris W. Parker
Redmond Militante on Monday, October 20, 2003 2:15 PM said: > for($j=0; $j < $categories_count; $j++){ > $categories_array = array(); > $tempval="str_categories".$j; > array_push($categories_array,'$_REQUEST['.$tempval.']'); > } > > it looks like it's appending the