[PHP] Basic multi-dimensional array help

2001-07-03 Thread Jeff Gannaway

I've got input fields in a form that look like:
INPUT TYPE=HIDDEN NAME=Person[0] VALUE=Jeff
INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Apples
INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Oranges
INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Peaches
INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Pears

INPUT TYPE=HIDDEN NAME=Person[1] VALUE=Carolyn
INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Apples
INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Oranges
INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Peaches
INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Pears

The next script processes all this into a database. Here are the results I
get from various commands:

sizeof($Info): 2
sizeof($Info[0]): 4
print $Info[0][0]: Array[0]

Any help?
Jeff Gannaway

___

SUMMER ART PRINT SALE at www.PopStreet.com
Save an additional 10% off art print orders of $50 or more.
Type in coupon code jemc when checking out.
___

Find the right art print for your home.
* Search by artist, color, art style and subject.
* Preview the art prints against your wall color.
* Specializing in contemporary, abstract and African
  American art.
* Every day discounts on thousands of fine art prints.

PopStreet.com is your avenue to art. 


http://www.popstreet.com 
___ 
Coupon may be redeemed from June 27 through July 31, 2001.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Basic multi-dimensional array help

2001-07-03 Thread Wieger Uffink

Hi Jeff,

There probably are several ways of doing this.

One is you copy $info[0] ( an array itself ) into a dummy variable, and
get the values with $dummy[0] etc.
Or use brackets in your variable syntax, which youll have to experiment
with cause, I can never seem to remeber the right syntax :)

something like ${$info[0]}[0] I think... correct me if Im wrong.

Hope this helps,
Wieger

Jeff Gannaway wrote:
 
 I've got input fields in a form that look like:
 INPUT TYPE=HIDDEN NAME=Person[0] VALUE=Jeff
 INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Apples
 INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Oranges
 INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Peaches
 INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Pears
 
 INPUT TYPE=HIDDEN NAME=Person[1] VALUE=Carolyn
 INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Apples
 INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Oranges
 INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Peaches
 INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Pears
 
 The next script processes all this into a database. Here are the results I
 get from various commands:
 
 sizeof($Info): 2
 sizeof($Info[0]): 4
 print $Info[0][0]: Array[0]
 
 Any help?
 Jeff Gannaway
 
 ___
 
 SUMMER ART PRINT SALE at www.PopStreet.com
 Save an additional 10% off art print orders of $50 or more.
 Type in coupon code jemc when checking out.
 ___
 
 Find the right art print for your home.
 * Search by artist, color, art style and subject.
 * Preview the art prints against your wall color.
 * Specializing in contemporary, abstract and African
   American art.
 * Every day discounts on thousands of fine art prints.
 
 PopStreet.com is your avenue to art.
 
 http://www.popstreet.com
 ___
 Coupon may be redeemed from June 27 through July 31, 2001.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
Wieger Uffink
tel: +31 20 428 6868
fax: +31 20 470 6905
web: http://www.usmedia.nl

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Basic multi-dimensional array help

2001-07-03 Thread scott [gts]

that's stanard array behaviour...
$Info contains two elements,
$Info[0] and $Info[1]

$Info[0] contains four elements,
$Info[0][0], $Info[0][1], $Info[0][2], $Info[0][3]

try this function on your $Info variable to
see what it contains:  array_traverse($Info);

function array_traverse ($ary, $b=array()) {
  while ( list($k,$v) = each($ary) ) {
print (join(, $b)) . $k = $v\n;
array_push($b, \t);
if ( is_array($ary[$k]) ) {
array_traverse($ary[$k], $b);
}
array_pop($b);
  }
  return 1;
}




 -Original Message-
 From: Jeff Gannaway [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 03, 2001 8:05 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Basic multi-dimensional array help


 I've got input fields in a form that look like:
 INPUT TYPE=HIDDEN NAME=Person[0] VALUE=Jeff
 INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Apples
 INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Oranges
 INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Peaches
 INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Pears

 INPUT TYPE=HIDDEN NAME=Person[1] VALUE=Carolyn
 INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Apples
 INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Oranges
 INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Peaches
 INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Pears

 The next script processes all this into a database. Here are the results I
 get from various commands:

 sizeof($Info): 2
 sizeof($Info[0]): 4
 print $Info[0][0]: Array[0]

 Any help?
 Jeff Gannaway

 ___

 SUMMER ART PRINT SALE at www.PopStreet.com
 Save an additional 10% off art print orders of $50 or more.
 Type in coupon code jemc when checking out.
 ___

 Find the right art print for your home.
 * Search by artist, color, art style and subject.
 * Preview the art prints against your wall color.
 * Specializing in contemporary, abstract and African
   American art.
 * Every day discounts on thousands of fine art prints.

 PopStreet.com is your avenue to art.


 http://www.popstreet.com
 ___
 Coupon may be redeemed from June 27 through July 31, 2001.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Basic multi-dimensional array help

2001-07-03 Thread Chris Anderson

When I wanted multi-dimensional with forms, I think I had to do this:
INPUT NAME=var[0][]
- Original Message -
From: Wieger Uffink [EMAIL PROTECTED]
To: Jeff Gannaway [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, July 03, 2001 8:32 AM
Subject: Re: [PHP] Basic multi-dimensional array help


 Hi Jeff,

 There probably are several ways of doing this.

 One is you copy $info[0] ( an array itself ) into a dummy variable, and
 get the values with $dummy[0] etc.
 Or use brackets in your variable syntax, which youll have to experiment
 with cause, I can never seem to remeber the right syntax :)

 something like ${$info[0]}[0] I think... correct me if Im wrong.

 Hope this helps,
 Wieger

 Jeff Gannaway wrote:
 
  I've got input fields in a form that look like:
  INPUT TYPE=HIDDEN NAME=Person[0] VALUE=Jeff
  INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Apples
  INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Oranges
  INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Peaches
  INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Pears
 
  INPUT TYPE=HIDDEN NAME=Person[1] VALUE=Carolyn
  INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Apples
  INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Oranges
  INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Peaches
  INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Pears
 
  The next script processes all this into a database. Here are the results
I
  get from various commands:
 
  sizeof($Info): 2
  sizeof($Info[0]): 4
  print $Info[0][0]: Array[0]
 
  Any help?
  Jeff Gannaway
 
  ___
 
  SUMMER ART PRINT SALE at www.PopStreet.com
  Save an additional 10% off art print orders of $50 or more.
  Type in coupon code jemc when checking out.
  ___
 
  Find the right art print for your home.
  * Search by artist, color, art style and subject.
  * Preview the art prints against your wall color.
  * Specializing in contemporary, abstract and African
American art.
  * Every day discounts on thousands of fine art prints.
 
  PopStreet.com is your avenue to art.
 
  http://www.popstreet.com
  ___
  Coupon may be redeemed from June 27 through July 31, 2001.
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 Wieger Uffink
 tel: +31 20 428 6868
 fax: +31 20 470 6905
 web: http://www.usmedia.nl

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]