disable some option in selectbox
Posted: Thu Oct 20, 2011 10:56 pm
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
if yes. how to handle it
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
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>";
}