只需注意选择选项中添加的 PHP 代码块。[更新]
<select id = "paisja" name="paisja" >
<?php while( $row = odbc_fetch_array($resultpaisja) ) {
$default_select_id = 1; //Set a default ID
if(isset($_REQUEST['paisja']) && $_REQUEST['paisja'] == $row['id_paisje']){
$select = ' selected="selected" '; //Set from submitted value
} elseif ($row['id_paisje'] == $default_select_id) {
$select = ' selected="selected" '; //Set from default ID if no submitted value
}
?>
<option value="<?php echo $row['id_paisje']; ?>" <?php echo $select; //Execute the selection ?> >
<?php echo $row['paisje']; ?>
</option>
<?php
}
?>