Question about select list functions
Posted: Thu Jan 31, 2008 5:12 pm
Quote from the file `class.module.inc.php` regarding the functions CreateInputDropdown and CreateInputSelectList:
"An array of items to put into the dropdown list... they should be $key=>$value pairs"
However, when I look at the code in `modform.inc.php`:
I know the index of a select item is called a 'value' by HTML-standard, but this doesn't make sense to me... Now I have to feed this function an array like this:
Looks very nasty to me, why is it done this way?
"An array of items to put into the dropdown list... they should be $key=>$value pairs"
However, when I look at the code in `modform.inc.php`:
Code: Select all
$text .= '<option value="'.$value.'"';
if ($selectedindex == $count || $selectedvalue == $value)
{
$text .= ' ' . 'selected="selected"';
}
$text .= '>';
$text .= $key;
$text .= '</option>';
Code: Select all
$list = array('Some text' => '1');