Revision: 54182
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 14, 2011 04:09 by dato
Initial Code
function selecciona($dis) { $arr = array('None', 'option 1', 'option 2', 'option 3', 'option 4'); for($i = 0; $i < count($arr); $i++) { $selected = ($arr[$i] == $dis) ? 'selected="selected"' : ''; echo "<option value=\"{$arr[$i]}\" {$selected}>{$arr[$i]}</option>\n"; } }
Initial URL
Initial Description
dynamically selects a value in a select according to what's already in the DB
Initial Title
Setting a select's selected value
Initial Tags
php, forms
Initial Language
PHP