[PHP-DB] Multiple checkboxes

2003-08-14 Thread Mike Baerwolf
Hello,

I'm trying to get the values from a form post with multiple checkboxes 
checked . Here is what I have,

if ($row = mysql_fetch_array($result));

do {
input type=checkbox name=class_id[] value=$row[class_id] $row[name]

 }while ($row = mysql_fetch_array($result));
and when submitted

if ($class_id) {
foreach($class_id as $varName)
print Variable: $varName\n;
}
All I get from this is Invalid argument supplied for foreach().  From 
what I could find doing a google search was to create an array using 
class_id[] and the above foreach().

Thanks in advance for any help!
Mike
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Multiple checkboxes

2003-08-07 Thread John W. Holmes
Mike Baerwolf wrote:

Hello,

I'm trying to get the values from a form post with multiple checkboxes 
checked . Here is what I have,

if ($row = mysql_fetch_array($result));

do {
input type=checkbox name=class_id[] value=$row[class_id] $row[name]
Try putting quotes around your attribute values...

input type=checkbox name=class_id[] value=$row[class_id]

Also, I assume you have an echo somewhere? Like:

echo input type=checkbox name=\class_id[]\ value=\{$row[class_id]}\;

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals  www.phparch.com





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