0
的第二頁基於選擇檢索數據,所以我不知道如何在標題中正確表達它,但我會在這裏完成。我有兩個頁面,第一個添加了一些列表視圖(每個都有值)。我想要的是,當用戶點擊一個項目,他/她進入第二頁,它會向他/她顯示一個列表視圖(根據他們選擇的值檢索MySQL數據)。但我的問題是,當我點擊第一頁中的一個項目時,它在第二頁中顯示我什麼都沒有。JQuery Mobile PHP MySQL基於第一頁
我已經嘗試了幾種方法幾天,現在它變得令人沮喪!我真的需要幫助。非常感激。
這是我的第一個頁面代碼:
<?php
session_start();
include "partials/connectDb.php";
if (isset($_POST["goverVal"]))
{
$_SESSION["goverVal"] = $_POST["goverVal"];
}
?>
<div data-role="page" id="homepage">
<!-- HEADER INCLUDE -->
<?php include "partials/header.php"; ?>
<div data-role="main" class="ui-content" align="center">
<h2>Select A Governorate</h2>
<form action="index.php" method="POST">
<ul data-role="listview" id="goverVal" name="goverVal">
<?php
include "partials/connectDb.php";
$sql = "SELECT * FROM governorate_table;";
$run_query = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_array($run_query))
{
$gId = $row['g_id'];
echo "<li data-value='{$gId}'><a href='area_page.php' class='ui-btn'>$gId - $row[name]</a></li>";
}
?>
</ul>
</form>
</div>
<!-- FOOTER INCLUDE -->
<?php include "partials/footer.php"; ?>
</div>
================================ =======================================
這是我第二頁的代碼:
<?php
session_start();
include "partials/connectDb.php";
$goverChoice = $_SESSION["goverVal"];
?>
<div data-role="page" id="areaPage">
<!-- HEADER INCLUDE -->
<?php include "partials/header.php"; ?>
<div data-role="main" class="ui-content" align="center">
<h2>Select an Area</h2>
<?php
include "partials/connectDb.php";
$q = "SELECT * FROM area_table WHERE governorate = '$goverChoice';";
$run_sql = mysqli_query($conn, $q);
echo "<ul data-role='listview'>";
while ($row = mysqli_fetch_array($run_sql))
{
echo "<li><a href='#'>".$row['area_name']."</a></li>";
}
echo "</ul>";
?>
</div>
<!-- FOOTER INCLUDE -->
<?php include "partials/footer.php"; ?>
</div>