我正在尝试在 ul li 标签中填充 mysql 表。我不可能成功。我不知道如何使用 jquery 来获取 mysql 数据。你们能帮帮我吗?我在 getdata.php 上得到了我的结果,没有任何问题。但是,如果不刷新页面,我无法成功在 main.php 中显示结果。
主文件
<form name="cnt" id="cnt" action="get_shipping_price.php" method="Post" >
<select id="c_list" name="country" style="width:160px;" onChange="this.form.submit()">
<?php
$countries = $database->getCountry();
foreach ($countries as $country) {
echo '<option value="' . $country['printable_name'] . '" ' . ($req_user_info['country'] == $country['numcode'] ? 'selected="selected"' : '') . '>' . $country['printable_name'] . '</option>';
}
?>
</select>
</form>
<!-- result list box -->
<div id="result_box">
<ul>
<li class="blue_heading">A</li>
<li class="blue_heading">O / E</li>
<li class="blue_heading">I / I</li>
<li class="lgray_lis"></li>
<li class="lgray_lis"></li>
<li class="lgray_lis"></li>
<li class="dgray_lis"></li>
<li class="dgray_lis"></li>
<li class="dgray_lis"></li>
</ul>
</div>
获取数据.php
<?php
include("include/database.php");
if(isset($_POST['country']) )
{
$cnt_id = $_POST['country'];
$result = $database->select("Select * From zone Where DHL = '$cnt_id' ");
foreach ($result as $row) {
$row['zone'];
}
}
$result = $database->select("Select * From price_in_dis");
foreach ($result as $indis)
{
if ($row['zone'] == 1)
{
echo "<ul>";
echo "<li>" .'y'.$indis['A']. "</li>";
echo "</ul>";
}
if ($row['zone'] == 2)
{
echo "<ul>";
echo "<li>" .$dis['C']. "</li>" ;
echo "</ul>";
}
if ($row['zone'] == 3)
{
echo "<ul>";
echo "<li>" .$dis['D']. "</li>" ;
echo "</ul>";
}
}
?>