我已经搜索了SOF并谷歌寻求答案,没有任何乐趣 我可以连接到我在JavaScript中假设的数据库,我希望将结果填充到HTML表单选项字段中。
<script type="text/javascript">
function gao(){
var An;
$sql = "SELECT * FROM Anouncements";
// Execute the query
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)){
an=$result[1];
return(an);
}
}
</script>
<head>
<body>
<form action="javascript:gao(s1)"/>
<select name="num" id="s1" required>
<option value="1">gao</option>
</select>
</form>