"Henri marc" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > Thank you very much for all the people who replied me > so fast. > Unfortunately I still have a problem with that part. > > "Matt M." <[EMAIL PROTECTED]> wrote: > > > Now, I want to know which numbers have been checked > by the player. > > I have a : > > "input name="Grid1" type="checkbox" > > for the first grid. Grid2 for the grid #2... > >if the user checks any Grid1[] boxes then > $_POST['Grid1'] will be an array and so on. > > I want to avoid to have to name each check box like > this: > Grid[1][1] file://1st checkbox of the first grid > Grid[1][2] file://2nd checkbox of the first grid and so on > > I would prefer to have if possible: > input name="Grid1[]" type"checkbox" file://1st grid, 1st > checkbox > input name="Grid1[]" type"checkbox" file://1st grid, 2nd > checkbox... > > That's what Matt M proposed. > If I do: echo $_POST['Grid1']; > I have "on" as a result and not a value. I also tried > with echo $_POST['Grid1[]']; and other similars but I > have an error message "undefined index", or "array". > > Thanks again. > > Dave
Hi Dave, try this: input name="Grid1[1]" type"checkbox" file://1st grid, 1st checkbox input name="Grid1[2]" type"checkbox" file://1st grid, 2nd checkbox... Pay attention to the indices in Grid1[1], Grid1[2]. After submit you will receive $_POST['Grid1'] as an ARRAY containing all indices of the checked checkboxes. Then loop through it and do what ever you want: foreach ($_POST['Grid1'] as $value) { echo $value; } Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php