CREAT SELECT OPTION, AND ALSO SHOWING PREVIOUSLY SELECTED OPTION BY USER FROM DATABASE.
<td>
NEWSPAPER NAME
<select id="newspaper_name" name="newspaper_name" class="form-control" required>
<?php
$sql = 'select * from newspapers';
$result = execute_query($sql);
while ($row = mysqli_fetch_assoc($result)) { echo '<option value="'.$row['sno'].'" ';
if(isset($_GET['id'])){
if($row1['newspaper_name']==$row['sno']){
echo ' selected="selected" ';
}
}
echo '>' . $row['newspaper_name'] . '</option>';
}
?>
</select>
</td>
No comments:
Post a Comment