Re: Re: HTML_quickform setdefaults question

From: Date: Sun, 10 Dec 2006 20:49:20 +0000
Subject: Re: Re: HTML_quickform setdefaults question
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-26066@lists.php.net to get a copy of this message
rav k wrote: > Thanks Mark, the fetchAll works fine to put all items of the array into > $checked. > > Can you give an example of what you mean by looping through the array to > change its representation. > So in this case each checkbox is called skill[n]; Not sure how the resulting array of fetchAll() looks like, but let's assume it's just something like this: $skills = array(3, 5, 7); You could then do the following (assuming that 1 means "checked"): $checked = array(); foreach ($skills as $skill) { $checked['skill[' . $skill . ']'] = 1; } [...] $form->setDefaults($checked); Regards, Mark

« previous php.pear.general (#26066) next »