如何在 PHP 中重新加载页面或表单。
场景:我有两个具有相同设计/gui的表单。我将它命名为 main.php 和 process.php。两个页面也有下拉列表,相同的项目。下拉列表中的项目是“Net 1”和“Net 2”,“Net 1”下面是“Bldg 1”,“Net 2”是“Bldg 2”。因此,在 main.php 中,当我单击提交时,它将继续到 process.php。然后process.php会在main.php的下拉列表中显示我选择的item的under item。
我的问题是:当用户想查看“Net 2”的下项时。我想要的是,在 button_process.php 的页面中只会重新加载或刷新数据,以便用户看到“Net 2”的项目,我该怎么办?
main.php 的代码:
<form action="process.php" method="post">
Advertisement Name: <input type="text" name="adName" size="50"><br/><br/>
Duration: <select id="duration"name="duration">
<option value="5 s" >5 s</option>
<option value="10 s" >10 s</option>
<option value="15 s" >15 s</option>
<option value="20 s" >20 s</option>
<option value="30 s" >30 s</option>
<option value="60 s" >60 s</option>
</select><br/><br/>
<b>Period</b> <br/>
From: <input type="text" id="datepickerfrom"name="from"> To: <input type="text" id="datepickerto"name="to">
<span id="span_select">
<select name="id">
<option value="" >- select -</option>
<?php
include 'connect.php';
$q = mysql_query("select fldNetname from tblnetwork");
while ($row1 = mysql_fetch_array($q))
{
echo "<option value='".$row1[fldNetname]."'>".$row1[fldNetname]."</option>";
}
?>
</select>
</span>
<input type="submit" name="pass" value="View Building/s">
</form>
Here's my Code for
process.php:编辑:
<form action="button_process.php" method="post">
echo "<div><input type='checkbox' class='checkall'> Check all</div>";
$all = mysql_query("SELECT fldBldgName FROM tblbuildings");
while ($row = mysql_fetch_array($all))
{
echo "<div><input type='checkbox' name='play[]' class='chk_boxes1' value='" . $row['fldBldgName']."'>";
echo $row['fldBldgName'];"</div>";
}
<input type="submit" name="pass" value="View Building/s">
</form>
button_process.php 的代码
<?php
include("connect.php");
switch ($_POST['pass']) {
case 'View':
//here I want to reload the page.
break;
case 'Save':
echo "Add";
break;
}
?>