我嘗試使用輸入文本作為選擇選項,我從谷歌找到了這個腳本
<input type="text" list="airports" name="airports">
<datalist id="airports">
<option value="Berlin">
<option value="Los Angeles">
<option value="Moscow">
<option value="Paris">
</datalist>
<input type="submit" value="confirm">
這是我之前的腳本:
<?php
$first="select * from members";
$two=mysql_query($first)or die("You Die!"); ?>
<select>
<? while($three=mysql_fetch_array($two)){ ?>
<option value=<? echo $three['firstname'];?><? echo $three['firstname'];?></option>
<? } ?>
</select>
當我組合它們時:
<?php
$first="select * from members";
$two=mysql_query($first)or die("You Die!"); ?>
<select>
<input type="text" list="firstname" name="firstname">
<datalist id="firstname">
<? while($three=mysql_fetch_array($two)){ ?>
<option value=<? echo $three['firstname'];?>><? echo $three['firstname'];?></option>
<? } ?>
</datalist>
</select>
它不起作用 t_t"
uj5u.com熱心網友回復:
嘗試這個:
<?php
$first="select * from members";
$two=mysql_query($first)or die("You Die!"); ?>
<select>
<input type="text" list="firstname" name="firstname">
<datalist id="firstname">
<? while($three=mysql_fetch_array($two)){ ?>
<option value="<? echo $three['firstname'];?>">
<? } ?>
</datalist>
</select>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/361132.html
標籤:javascript php html 查询 阿贾克斯
