Re: Drawing checkboxes
| From: | Mike | Date: | Tue, 07 Dec 2004 21:00:31 +0000 |
| Subject: | Re: Drawing checkboxes | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-203700@lists.php.net to get a copy of this message | ||
Thanks Chris, but the $default variable is a string of values separated by
pipe delimiters.
Like so 'value1|value2|value3'
So 'value1' should be true
Whereas 'val' should not be.
Make sense?
on 12/7/04 3:54 PM, Chris W. Parker at cparker@swatgear.com wrote:
> Mike <mailto:mike@macagent.com>
> on Tuesday, December 07, 2004 12:11 PM said:
>
>> I use the strstr() function to check against the $default so I can
>> check it if so.
>>
>> Well it works great..BUT, lets say the product has a category of
>> "Coffee Pots", but the one of the values available is "Coffee".
>>
>> In this case both "Coffee" AND "Coffee Pots" get checked when only
>> "Coffee Pots" should.
>>
>> What can I do to this function eliminate this?
>
> don't look for merely the existence of "Coffee" but instead look for an
> exact match.
>
> Change:
>
>> if(strstr($default, $values[$i]['id'])) {
>> $field .= ' CHECKED';
>> }
>
> Into:
>
> if($default == $values[$i]['id']) {
> $field .= ' CHECKED';
> }
>
> ??
>
> That will work unless I'm not understanding how $default and
> $values[$i]['id'] are defined.
>
>
>
> hth,
> Chris.
+--------------------------------------------+
Mike Yrabedra
Mac@gent.com
Your Mac Intelligence Resource
+--------------------------------------------+
W: http://www.macagent.com/
E: agenty@macagent.com