weixin_33681778 2014-12-04 13:12 采纳率: 0%
浏览 10

PHP Ajax下拉框

<?php
require ("init.php");

?>
<head>
<script src="ajax.js"></script>
<script src="common.js"></script>
</head>
<body>
<?php
$query = "SELECT * FROM User1";
$result = mysqli_query($connection, $query);
echo '<form> ';
echo "Select a Users:"; 
echo '<select name="users" onchange="showUser(this.value)">';
while ($row=mysqli_fetch_assoc($result)){
    echo $row=['Username'];
    echo '<option value="'.$row=['Username'].'">'.$row=['Username'].'</option>';
}
echo '</select></form>';
?>

<div id="txtHint"><b>User info will be listed here.</b></div>

</body>

the problem i am having is that the drop down box only shows array multiple times and does not show usernames from my database however the connection to my database is working as when tryed debugging it got it to echo out just one username

  • 写回答

2条回答

      报告相同问题?

      悬赏问题

      • ¥15 Android URL如何转成视频/音频,可行吗?
      • ¥20 SQL数据查询,子查询
      • ¥15 c++字符串分割问题
      • ¥15 关于#sql#的问题:没有用命令关闭cdc,手动把系统表开启的cdc右键删除了
      • ¥15 vue+uniapp
      • ¥15 android freedom
      • ¥15 使用自定义的类型代替内置类型可行吗
      • ¥15 关于STM32的SPI和ENDAT接口编码器通信的问题
      • ¥15 关于#pdfbox#生成的PDF文件正常,转图片中文乱码的问题,如何解决?
      • ¥15 ADS中有关DAC控件的使用问题