Re: [PHP] Drawing checkboxes

2004-12-08 Thread Richard Lynch
> The problem is this. The Values are formatted like this... > > value1|value2|value3...etc... > > 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 a

Re: [PHP] Drawing checkboxes

2004-12-08 Thread Brent Baisley
If I have to pass name/value pairs to a function or anything else, I always use an multidimensional associative array (that's a mouthful). Using a string delimiter is too unreliable and probably slower. Something like this: $checkBoxList[] = array('name'=>'Coffee','value'=>'Coffee','checked'=>'

Re: [PHP] Drawing checkboxes

2004-12-07 Thread Christopher Fulton
so switch the two things. > > I would change it to this. > > $checkValues = array() > > $checkValues = explode("|", $default); > > if(in_array($values[$i]['id'], $checkValues)) { > > $field .= ' CHECKED'; > > } i could be misinterpreting y

Re: [PHP] Drawing checkboxes

2004-12-07 Thread Mike
Chris, Good idea, but $default is the value with pipe delimiters. on 12/7/04 4:11 PM, Christopher Fulton at [EMAIL PROTECTED] wrote: > A few notes that may help you. > > first.on strstri would use strpos instead for a simple checkso >> if(strstr($default, $values[

Re: [PHP] Drawing checkboxes

2004-12-07 Thread Christopher Fulton
A few notes that may help you. first.on strstri would use strpos instead for a simple checkso > if(strstr($default, $values[$i]['id'])) { > $field .= ' CHECKED'; > } would become > if(strpos($default, $values[$i]['id']) !== false) { >

RE: [PHP] Drawing checkboxes

2004-12-07 Thread Scott DeMers
If I understand you, calling the function like so : /**/ $value1 = "coffee"; $value2 = "coffee pots"; $returned = estrstr($value1, $value2); /**/ returns the string "coffee". Well, I just ran that exact piece of code you see above, and received the expected NULL value. I don't see how you are ge

Re: [PHP] Drawing checkboxes

2004-12-07 Thread Mike
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 [EMAIL PROTECTED] wrote: > Mike

RE: [PHP] Drawing checkboxes

2004-12-07 Thread Chris W. Parker
Mike 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 "Cof