Re: getting check box values into an array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 31 Mar 2005 12:45:04 +0200, Merlin <news.groups@xxxxxx> wrote:
> Hi there,
> 
> I am facing a problem in getting all values from a form.
> There are loads of input check boxes in there which are named:
> x_1, x_2 etc.
> 
> Now I want to get that post data into an array.
> 
> Somehow like this:
> for ...{
>     $interests[] = $_POST[x_1];
> }
> 
> The problem is that the script does not know how many x there are and it does
> not know the number. So how to get them all?
> 
> Has anybody an idea, I am lost on that one.
> 
> Thanx for any hints,
> 
> Merlin
> 
> PS: I know that there is another way in passing the checkbox values, but due to
> some JS reasons I do have to go that way.

check the php manual for the function foreach

 foreach($_POST as $value)
 {
     $interests[] = $value;
 }

hth, sorry for the first mail i screwed up :D

ken

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux