RE: [PHP] Drawing checkboxes

From: Date: Tue, 07 Dec 2004 20:54:16 +0000
Subject: RE: [PHP] Drawing checkboxes
Groups: php.general 
Request: Send a blank email to php-general+get-203699@lists.php.net to get a copy of this message
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.

« previous php.general (#203699) next »