> -----Original Message-----
> From: Merlin [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 31, 2005 12:45 PM
> 
> 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.

How do You create these names? See below for a smart solution.

> Now I want to get that post data into an array.
> 
> Somehow like this:
> for ...{
>     $interests[] = $_POST[x_1];
> }

$interests[] = $_POST['x_1']; is correct syntax
 
> 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.

So 

<input type="checkbox" name="interests[$i] value="1"> 

is not an option? Cause that would be the smartest way to do it. In this
way all the checked boxes are in $_POST['interests'] and can be seen
with 

print var_dump($_POST['interests'])

You create the checkboxes with a for loop

--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/systemdeveloper

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

Reply via email to