Page 1 of 1

disable some option in selectbox

Posted: Thu Oct 20, 2011 10:56 pm
by Lphp
Hi all I have drop down select box the value is select out of db , is that possible to disable some option ?
if yes. how to handle it :|

Re: disable some option in selectbox

Posted: Fri Oct 21, 2011 1:22 am
by manohoo

Code: Select all

$omit = array('notanoption','whatever'); // values to omit from check box	
// $result is an array containing key value pairs from database

foreach ($result as $key=>$value) {
   if (in_array($value, $omit) ) { } // do nothing
   else echo "<INPUT TYPE='checkbox' name='$key' value='$value'> </INPUT>";
}

Re: disable some option in selectbox

Posted: Fri Oct 21, 2011 5:23 am
by Lphp
thank