What version of PHP are you using? Is register_globals on or off?

Try $_GET['foo'] as the array name, instead of $foo, or $_POST['foo'],
depending on the method of your form.

---John Holmes...
----- Original Message -----
From: "Michael Hall" <[EMAIL PROTECTED]>
To: "1LT John W. Holmes" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; "Brad Harriger"
<[EMAIL PROTECTED]>
Sent: Wednesday, May 29, 2002 7:39 PM
Subject: Re: [PHP] HTML Checkboxes and PHP variables


>
> I've been wrestling with the same issue. I had some code loop through and
> create an arbitrary number of checkbox inputs with the name 'foo[]'
>
> I then attempted to access the array using:
>
> foreach ($foo as $bar)
> {
> echo $bar;
> }
>
> but I got error messages telling me that $foo is not an array :-(
>
> I'm using Netscape 4.7 something on Red Hat 6.2 ... could this be an
> issue? I know Netscape can be pretty buggy and fussy at the best of times.
>
> Michael
>
>
> On Wed, 29 May 2002, 1LT John W. Holmes wrote:
>
> > If you name the form elements as arrays, then yeah, they are pretty much
the
> > same.
> >
> > <input type=checkbox name=foo[] value=one>One
> > <input type=checkbox name=foo[] value=two>Two
> > <input type=checkbox name=foo[] value=three>Three
> >
> > When submitted, $foo will be an array containing the values that were
> > checked. If a box was not checked, it won't have any value in the array.
> >
> > i.e. If you check One and Three, then you'll have a $foo array like
this:
> >
> > $foo[0]='one';
> > $foo[1]='three';
> >
> > ---John Holmes...
> >
> > ----- Original Message -----
> > From: "Brad Harriger" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, May 29, 2002 8:56 AM
> > Subject: [PHP] HTML Checkboxes and PHP variables
> >
> >
> > > Are HTML Checkbox values handled the same way as Select Multiple tags?
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
> >
>
> --
> --------------------------------
> n   i   n   t   i  .   c   o   m
> php-python-perl-mysql-postgresql
> --------------------------------
> Michael Hall     [EMAIL PROTECTED]
> --------------------------------
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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

Reply via email to