Name each of the checkboxes "grid[]" (<input type="checkbox" name="grid[]"
value="your_value">Your Text), then in your processing script,
$_POST['grid'] will be an array with the values of all the checked boxes
(assuming at least one was checked - otherwise it won't be set).  If you
want a limit on the number of boxes you can check, try a little Javascript.

Hope it helps,
Will

-----Original Message-----
From: Henri Marc [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 20, 2004 1:10 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Problem of a beginner with Array

Hello,
 
I'm just starting with PHP and I have a problem. This is certainly very easy
for you but for me, it's tough.
 
I want to make a lottery site (just as an exercise), so I made a page with 6
grids of 50 numbers each (check boxes).
 
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...
 
I was thinking to get the numbers chosen by the player with
$_POST['Grid1[]']
Grid1 being a table but it doesn't work. I thought I wouldn't have to
declare an array. I have 50 numbers for each grid, I don't want to have to
type array followed by the 50 numbers. There is not a way to do something
like array(1...50).
 
What is the solution?
 
Thank you very much (in advance) for your help.
 
Dave

                
---------------------------------
Créez gratuitement votre Yahoo! Mail avec 100 Mo de stockage !
Créez votre Yahoo! Mail

Yahoo! Messenger : dialoguez instantanément avec vos amis - c'est  gratuit !

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

Reply via email to