Hi Keith:

Unfortunately, the information has to be sent to php. As soon as I add the [] brackets to
an input name, the javascript no longer functions. I'll look up a javascript mailing list next,
but I figured there must be some other way to get php to recieve the data and convert it
to an array.

If your checkboxes all have the same name i.e. group, then for php to see them, you have to name them group[].
Then you can use something like this to get them out of the array:

if (count($group) > 0){
for($i=0; $i < count($group); $i++) {
$sql = "INSERT INTO groupImage VALUES ";
$sql .= "(0, '$imageID', '$group[$i]')";
mysql_query($sql) or die(mysql_error());
//echo "linked \"$imageName\" to groupID=".$group[$i]." in gi table<br>";
}
}
you might have to change the js.
If you are accessing form elements in js then you can use something like:
forms.elements['group[]']
to access the js checkbox array by name.

Does anyone have an idea how I can make the php script gather all the multiple
&browser=lynx&browser=mosaic&browser=explorer
instead of only the last entry?
AFAIK varName[] is the only way to go if you want the checkboxes in an array.

I suppose you could just give a unique name to each checkbox.
I believe that PHP will have a value for those checkboxes that are checked.
Then you could loop through your set of checkbox vars and see which have a value.

HTH

David


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



Reply via email to