1
我有时所选择的第一个,我想3个选择下拉菜单确定下一选择菜单,所述第二显示出来,并且当选择第二时,第三个显示了,通过使用if(isset($_post[first_one]))
和第三一个使用if(isset($_post[second_one]))
由先前的选择
SQL:
$conn = new mysqli($servername, $username, $password, $dbname);
$sql = "SELECT * FROM sp_meeting_log ";
$result1 = $conn->query($sql);
PHP/HTML:
<div style="position:absolute; top:300px; left:500px;">
<form method="post">
<p>Choose:</p>
<!--Get all orgs ,forums ,Users data available for admin-->
//select the first
<select style="display:inline-block;" name="org">
<option value="All Orgs">All Orgs</option>
//first drop down info release
<?php
if ($result1->num_rows > 0) {
echo "<table><tr><th>orgID</th><th>orgName</th></tr>";
// output data of each row
while($row = $result1->fetch_assoc()) {
echo "<option>" .$row["orgID"]." /".$row["orgName"]."</option>";
}
echo "</table>";
} else {
echo "0 results";
}
?>
</select>
<select style="display:inline-block;" name="forum">
<option value="forum1"><h5>All Forums</h5></option>
<?php
// if the first dropdown post set
if(isset($_POST['org'])){
$result2 = $conn->query($sql);
if ($result2->num_rows > 0) {
echo "<table><tr><th>forumID</th><th>forumName</th></tr>";
// output data of each row
while($row = $result2->fetch_assoc()) {
echo "<option>".$row["forumID"]."/".$row["forumName"]."</option>";
}
echo "</table>";
} else {
echo "0 results";
}
}
?>
</select>
//select the second
<select style="display:inline-block;" name="user">
<option><h5>All Users</h5></option>
<?php
// if the second drop down is set
if(isset($_POST['forum'])){
$result3 = $conn->query($sql);
if ($result3->num_rows > 0) {
echo "<table><tr><th>userID</th><th>username</th></tr>";
// output data of each row
while($row = $result3->fetch_assoc()) {
echo "<option>".$row["userID"]."/".$row["username"]. "</option>";
}
echo "</table>";
} else {
echo "0 results";
}
}
?>
当我发布第一,还是第二和第三它不露面 – moh89
@Rasclatt TNX花花公子的修正,但我没有书面方式纸或学术的东西,而不是纠正我writti ng错误,找出解决这个问题的方法,tnx – moh89
你的代码格式化对于那些试图帮助你找出问题解决方案的人来说是礼貌的。当阅读剧本很难,人们倾向于跳过你的问题,因为它不值得尝试混淆它的麻烦,而你的问题标题本身并没有非常简洁地描述你的问题。作为SO的用户修改格式(以及与内容有关的其他问题)也是一项普遍的责任,尤其是在格式与您的格式一样糟糕的情况下。 – Rasclatt