I got the following code:
Code: Select all
pulldown(employee,pulldown_l,getContacts(employee,name),k_nr,firstname,name);Code: Select all
function pulldown($name, $style, $source, $index, $value1, $value2, $value3)
{
$index_array=array();
$value1_array=array();
$value2_array=array();
$value3_array=array();
while($row=@mysql_fetch_array($source))
{
array_push($index_array,$row[$index]);
array_push($value1_array,$row[$value1]);
array_push($value2_array,$row[$value2]);
array_push($value3_array,$row[$value3]);
}
echo '<select name="' . $index . '" size="1" class="' . $style . '">';
echo '<option>' . $name . '</option>';
echo '<option disabled></option>';
for($i=0;$i<count($index_array);$i++)
{
echo '<option value="' . $index_array[$i] . '"';
if ($_POST[$index]==$index_array[$i]) { echo ' selected="selected"'; }
echo '>';
echo $value1_array[$i] . ' ' . $value2_array[$i] . ' ' . $value3_array[$i] . '</option>';
}
echo '</select>';
}Code: Select all
if ($_POST[$index]==$index_array[$i]) { echo ' selected="selected"'; }Code: Select all
$_POST['$index']Thanks for your help.