Henri,
Try:
if($HTTP_POST_VARS['submit'])
{
for($i = 1; $i < 51; $i ++)
{
if (${lottery_number.$i} == 'on')
echo "Number selected is $i";
}
}
else
{
echo "<form action='".$PHP_SELF."' method='post'>";
for($i = 1; $i < 51; $i ++)
{
echo "Number $i: <input type='checkbox' name='lottery_number".$i."'><br />";
}
echo "<input type='submit' name='submit' value='Enter Numbers'>";
echo "</form>";
}
HTH,
Michael Egan
> -----Original Message-----
> From: Henri Marc [mailto:[EMAIL PROTECTED]
> Sent: 21 July 2004 12:33
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Problem of a beginner with Array[Scanned]
>
>
> 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] //1st checkbox of the first grid
> Grid[1][2] //2nd checkbox of the first grid and so on
>
> I would prefer to have if possible:
> input name="Grid1[]" type"checkbox" //1st grid, 1st
> checkbox
> input name="Grid1[]" type"checkbox" //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
>
>
>
>
>
>
> Cr�ez gratuitement votre Yahoo! Mail avec 100 Mo de stockage !
> Cr�ez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/
>
> Yahoo! Messenger: dialoguez instantan�ment avec vos amis.
> T�l�chargez GRATUITEMENT sur http://fr.messenger.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
The information contained in this email (and in any attachments sent with it) is
confidential. It is intended for the addressee only. Access to this email by anyone
else is unintended and unauthorized.
If you are not the original addressee, 3tc asks you to please maintain
confidentiality. If you have received this email in error please notify 3tc
immediately by replying to it, then destroy any copies and delete it from your
computer system.
Any use, dissemination, forwarding, printing or copying of this email by anyone except
the addressee in the normal course of his/her business, is strictly prohibited. 3tc
owns the copyright in this email and any document created by us and assert the right
to be identified as the author of it. Copyright has not been transferred to the
addressee.
We protect our systems with Sophos Anti-virus -
www.sophos.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php