Re: need help w a for loop
| From: | Redmond Militante | Date: | Mon, 20 Oct 2003 21:31:56 +0000 |
| Subject: | Re: need help w a for loop | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-166854@lists.php.net to get a copy of this message | ||
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['$str_categories0']
echo $tempval; //gives me 'str_categories9'
$str_categories0=$_REQUEST['str_categories0'];
echo $str_categories0; //gives me the string 'Newspaper'
i'd like to append 'Newspaper' to the array...
thanks
redmond
[Mon, Oct 20, 2003 at 02:26:49PM -0700]
This one time, at band camp, Chris W. Parker said:
> Redmond Militante <mailto:r-militante@northwestern.edu>
> 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 string
> > '$_REQUEST['str_categories0']' to the array $categories_array
>
> that's because you've got:
>
> > array_push($categories_array,'$_REQUEST['.$tempval.']');
>
> and not:
>
> > array_push($categories_array,$_REQUEST[$tempval]);
>
>
>
> Chris.
>
> --
> Don't like reformatting your Outlook replies? Now there's relief!
> http://home.in.tum.de/~jain/software/outlook-quotefix/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
FreeBSD 5.1-RELEASE-p10 FreeBSD 5.1-RELEASE-p10 #0: Fri Oct 3 21:30:51 CDT 2003
4:30PM up 6 days, 8:11, 3 users, load averages: 1.00, 1.00, 1.00
Fights between cats and dogs are prohibited by statute in Barber, North
Carolina.