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
ke [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 07, 2004 3:11 PM To: PHP List Subject: [PHP] Drawing checkboxes Hello, I am having a hard time figuring this one out, maybe someone here (with fresh eyes) can offer a suggestion? Here is the function... // Draw Checkbox Menu funct

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

[PHP] Drawing checkboxes

2004-12-07 Thread Mike
Hello, I am having a hard time figuring this one out, maybe someone here (with fresh eyes) can offer a suggestion? Here is the function... // Draw Checkbox Menu function draw_checkbox_menu($name, $values, $default = false, $parameters = false) { for ($i=0; $i '; }