Re: Re: HTML_quickform setdefaults question
| From: | rav k | Date: | Sun, 10 Dec 2006 21:07:59 +0000 |
| Subject: | Re: Re: HTML_quickform setdefaults question | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-26067@lists.php.net to get a copy of this message | ||
Hmm not working quite right:
My $checked array is like this:
array(4) {
[0]=> array(1) { ["skillid"]=> int(2) }
[1]=> array(1) { ["skillid"]=> int(3) }
[2]=> array(1) { ["skillid"]=> int(6) }
So 2, 3, 6 means that skills[2], skills[3] and skills[6] should be checked.
I did this:
foreach ($checked as $s) {
$checked['skills['.$s.']'] =1;
}
But that creates another array:
["skills[Array]"]=> int(1) }
which is obviously incorrect.
I tried
($checked as $skillid) {
$skills[$skillid];} But that just returned NULL... what am I doing incorrectly here? www.bitesoftware.com - software for a better lifestyle
From: Mark Wiesemann <wiesemann@php.net> To: pear-general@lists.php.net Subject: Re: [PEAR] Re: HTML_quickform setdefaults question Date: Sun, 10 Dec 2006 21:49:20 +0100 MIME-Version: 1.0 Received: from lists.php.net ([216.92.131.4]) by bay0-mc10-f11.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2444); Sun, 10 Dec 2006 12:51:31 -0800 Received: from [216.92.131.4] ([216.92.131.4:5345] helo=lists.php.net)by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTPid 5B/EE-00543-2537C754 for <rav220@hotmail.com>; Sun, 10 Dec 2006 15:51:31 -0500 Received: (qmail 26733 invoked by uid 1010); 10 Dec 2006 20:49:51 -0000 Received: (qmail 26725 invoked by uid 1010); 10 Dec 2006 20:49:51 -0000 X-Message-Info: LsUYwwHHNt3660MmjhEvYg2f34OAemlK3oXsmRrh6gU= Return-Path: <pear-general-return-26066-rav220=hotmail.com@lists.php.net> X-Host-Fingerprint: 216.92.131.4 lists.php.net Mailing-List: contact pear-general-help@lists.php.net; run by ezmlm Precedence: bulk list-help: <mailto:pear-general-help@lists.php.net> list-unsubscribe: <mailto:pear-general-unsubscribe@lists.php.net> list-post: <mailto:pear-general@lists.php.net> Delivered-To: mailing list pear-general@lists.php.net Delivered-To: ezmlm-scan-pear-general@lists.php.net Delivered-To: ezmlm-pear-general@lists.php.net X-Host-Fingerprint: 212.117.93.247 clx-ac2-247-3.westend.com User-Agent: 40tude_Dialog/2.0.15.1de (88065b5a.265.175) References: <1hcmv5dm1t71n.jzw7l692nqcq.dlg@40tude.net> <BAY108-F273442798ECF6AA898E1DC9AD10@phx.gbl> X-Posted-By: 212.117.93.247 X-OriginalArrivalTime: 10 Dec 2006 20:51:31.0491 (UTC) FILETIME=[F89DB730:01C71C9C] 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) {_________________________________________________________________ Windows Live Messenger has arrived. Click here to download it for free! http://imagine-msn.com/messenger/launch80/?locale=en-gb$checked['skill[' . $skill . ']'] = 1;} [...] $form->setDefaults($checked); Regards, Mark -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php