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