PHP gevorderde |
|
Dit zou moeten werken, uit de losse hand geschreven dus niet getest
<?php
echo '
<tr class="row2">
<td width="10"></td>
<td>Medewerker(s) :</td>
<td colspan="3">
<select name="medewerker[]" multiple="multiple">';
$sql = "SELECT id, naam FROM gebruiker ORDER BY medewerker ASC";
$resultaat = mysql_query($sql) or die(mysql_error());
while($assoc = mysql_fetch_assoc($resultaat)){
echo '<option value="'.$assoc['id'].'" '.(isset($_POST['medewerker']) && in_array($assoc['id'], $_POST['medewerker']) ? 'selected="selected"' : '').'>'.$assoc['naam'].'</option>';
}
echo '</select>';
?>
<?php <tr class="row2"> <td width="10"></td> <td>Medewerker(s) :</td> <td colspan="3"> <select name="medewerker[]" multiple="multiple">'; $sql = "SELECT id, naam FROM gebruiker ORDER BY medewerker ASC"; echo '<option value="'.$assoc['id'].'" '.(isset($_POST['medewerker']) && in_array($assoc['id'], $_POST['medewerker']) ? 'selected="selected"' : '').'>'.$assoc['naam'].'</option>'; } ?>
|