Re: Drawing checkboxes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxxx wrote:

> Mike <mailto:mike@xxxxxxxxxxxx>
>     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@xxxxxxxx 
Your Mac Intelligence Resource
+--------------------------------------------+
W: http://www.macagent.com/
E: agenty@xxxxxxxxxxxx

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux