【发布时间】:2021-12-18 16:27:48
【问题描述】:
大家好,我想根据用户输入过滤数据。用户必须在第一个输入中选择公司,然后在第二个选项卡中选择游戏,所以我试图只向他们展示来自选定公司的游戏(用户在第一个选项卡中选择)。如果有人可以帮助我,这是我的代码 plzzz
<div class="form-group">
<label for="company">Company Name</label>
<select name="company" autocomplete="off">
<?php $sql = "SELECT * from clients having manager like '%$uname%'" ;
$query = $dbh -> prepare($sql);
$query->execute();
$results=$query->fetchAll(PDO::FETCH_OBJ);
$cnt=1;
if($query->rowCount() > 0)
{
foreach($results as $result)
{ ?>
<option value="<?php echo htmlentities($result->company);?>"><?php echo htmlentities($result->company);?></option>
<?php
}} ?>
</select>
</div>
<div class="form-group">
<label for="game">Game Name</label>
<select name="game" autocomplete="off">
<?php $sql = "SELECT * from clientgames having company like '%..........????......%'" ;
$query = $dbh -> prepare($sql);
$query->execute();
$results=$query->fetchAll(PDO::FETCH_OBJ);
$cnt=1;
if($query->rowCount() > 0)
{
foreach($results as $result)
{ ?>
<option value="<?php echo htmlentities($result->gamename);?>"><?php echo htmlentities($result->gamename);?></option>
<?php }} ?>
</select>
</div>```
【问题讨论】:
标签: javascript php html mysql