RE: [PHP-DB] using a variable as values in an array

2003-03-31 Thread Jennifer Goodie
Instead of building a string in your loop do the assignment in the loop I have no idea what is being pulled from where, so I can't really give a good example -Original Message- From: Charles Kline [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 1:25 PM To: [EMAIL PROTECTED]

Re: [PHP-DB] using a variable as values in an array

2003-03-31 Thread Charles Kline
Here is more details. Thanks for the reply. I am using HTML_QuickForm (pear) to create my forms. In order to set the default state of some of the elements (checkboxes in this case) I need to pass an array as the value to QuickForm. This array needs to be in the format of this:

RE: [PHP-DB] using a variable as values in an array

2003-03-31 Thread Jennifer Goodie
$mystring; foreach ($sth_opt as $thekey = $thevalue){ $mystring .= '.$thevalue.'=true, ; } $defaultValues['ib_article'] = array($mystring); Try this ... foreach ($sth_opt as $thekey = $thevalue){ $defaultValues['ib_article'][$thevalue] = 'true'; } I'm not sure if the indices

Re: [PHP-DB] using a variable as values in an array

2003-03-31 Thread Charles Kline
Hmm... that is not quite it. Here is a better example: Here is how I would define default values for a checkbox in HTML_QuickForm; $defaultValues['ichkABC'] = array('A'=true,'B'=true); $form-setDefaults($defaultValues); The checkboxes are defined later like this: $checkbox[] =