Hi Uwe, If you define the checkbox list as an array (OptionList[] in the example below), only the checked values will be returned as an array $OptionList when you post the form. You can then use this as an array or pass it as an array to a function in the script:
<? $i = 0; while (isset($OptionList[$i])) { echo "You have chosen option ".$OptionList[$i]."<br>"; $i++; } ?> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> <form name="form1" method="post" action="test.php"> <input type="checkbox" name="OptionList[]" value="something1">Option 1</input><br> <input type="checkbox" name="OptionList[]" value="something2">Option 2</input><br> <input type="checkbox" name="OptionList[]" value="something3">Option 3</input><br> <input type="submit" name="Submit" value="Test"> </form> </body> </html> Regards Rudolf Visagie Principal Software Developer Digital Healthcare Solutions -----Original Message----- From: Uwe Birkenhain [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 04, 2002 10:53 AM To: [EMAIL PROTECTED] Subject: [PHP] How to pass unknown number of variables to a function? Hi everybody on this rainy morning! My problem: I give the user a form with a list of options with checkboxes. The list is long and not predictable - the values change always. I want to put the checked values (or all, that doesn't matter) in an array, to pass it to my function. How can I write those keys and values in an array? I suppose it will be best done with JS - but since I don't know JS ... Has anybody a ready solution? Thank's a lot! Uwe -- 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