<?php
//
//$array - any array{2} filled with data from any query "select ---- as value, ---- as
display_value from any_table where any_condition"
//$name - name of listbox
//$selected - if you want to display any value at the construction event or after submit event,
just set it to the value taht you want to display
//$atrribs - things required to visiualize lisbox eg. css,html inner tags
//$events - any kind of events from Javascrip pool
//
function insertListBox($array,$name,$selected,$attribs,$events)
{
printf("<select name=$name $attribs $events>");
printf("<option value=>select something");
for($i=0;$i<sizeof($array);$i++)
{
$row = $array[$i];
if($row->id == $selected)
{
printf("<option value=$row->value selected>$row-
>display_value");
}
else
{
printf("<option value=$row->value>$row->display_value");
}
}
printf("</select>");
}
?>