You learn something new every day! I'll have to remember the [] thing.
My way of handling this situation that does not screw up JavaScript is to assign the 
names sequentially, so instead of all the checkboxes being system they would be 
system0,system1,... Since PHP is so wonderfully easy to use for referencing variable 
variable names I simply loop through:

for($i=0;$i<NUMBEROFCHECKBOXES;$i++){
  $var = "system$i";
  $val = $$var;
  if (isset($$var)) //<--- I think this works.
    echo "$var = $val<br>";
  else
    echo "$var is not checked.";
}

Since I always end up creating the form in PHP I just have the algorithm put a hidden 
field in the form that contains the number of checkboxes, in fact my PHP usually 
creates the JavaScript code as well, so it ends up being pretty flexible.

<>< Ryan


-----Original Message-----
From: Rich Gray [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 19, 2002 6:13 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: RE: [PHP-DB] HTML Forms question...


If you name the checkbox as name="system[]" then PHP will automatically
create an array of the checkbox values which can be subsequently accessed
via $_POST['system'][n] - be warned however that the '[]' can screw up any
JavaScript code that refers to the checkbox object...

HTH
Rich
-----Original Message-----
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
Sent: 19 November 2002 08:53
To: 'Ryan Jameson (USA)'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] HTML Forms question...


        OK.  If I am using the POST method and the checkbox 'name' for all
of the checkboxes is 'system', how do I access the results?  I am
researching on the PHP site trying to figure out what this array is, and how
I access this if the index name is the same for all elements.  I am hoping
that this data will be in an array and I can simply loop through the
contents of the array.  If this data is stored in a hash (Perl word for this
type of array, not sure if it's the same in PHP), how do I access this data
since the index for every element would be the same?
        I am SURE that I am probably missing some important conceptual
issues here, but still learning as I go.  Unfortunately, this probably means
that I will be completely rewriting this application at least once in the
future.  Oh well, live and learn.  Thanks again for the help.


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


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

Reply via email to