id_view.html:
<div>
<form method="post" action="../tab/tab.php">
<p>按记录序号(ID)查询:
<input name="id" type="text" >
</p>
<p>
<input name="Submit" type="submit" value="查询" >
</p>
</form>
</div>
解决方案 »
- 求 oscommerce 前台和后台结构说明
- apache将post和get方法获得的值存在哪?PHP5又是如何获得这些值的?
- foreach 多维数组怎么遍历和存储???
- 求助! 哪位兄弟能不能提供一些经典的源程序啊!
- 哪位朋友帮我看看啊 我把完整代码贴出来 实在没有分了 高手请指教吧(关于suggest) 谢谢了
- 在线等朋友帮助给个PHP域名查询代码文件
- 这是个什么错误,以前一直用的很好的,现在突然出错了!
- 请问,如何实现关闭页面的同时自动删除session?
- 问一个低级问题,如何在一个页面中进行表单提交。
- 数据库读出来的数据怎么与定义好的常量对应?
- PHP+SQL如何自动排列
- 请教如何调用类里COOKIE值
include("../conn_mysql.php");//连接数据库的命令
//$sql="SELECT * FROM new_cus_information"; //sql查询语句
//$query=mysql_query("$sql");//送出查询语句
//$assoc= mysql_fetch_assoc($query);///影响的行数 //注释掉
//echo "$assoc"; //注释掉
if( isset($_POST["page"]) && $_POST["page"] != "") {
$page = $_POST['page'];
}
if($page == "") {
$page = 1;
}
if(is_numeric($page)) {
$page_size = 15; //每页多少条数据
if( isset($_POST["id"]) && $_POST["id"] != "") {
$id = $_POST['id'];
$query = mysql_query("select count(*) as total from new_cus_information where id = '$id'");
$count = mysql_fetch_row($query);
$message_count = $count[0];
$page_count = ceil($message_count / $page_size);
$offset = ($page - 1) * $page_size;
$result = mysql_query("select * from new_cus_information where id = '$id' limit $offset, $page_size");
}
else if( isset($_POST["inputer"]) && $_POST["inputer"] != "") {
$inputer = $_POST['inputer'];
$query = mysql_query("select count(*) as total from new_cus_information where inputer = '$inputer'");
$count = mysql_fetch_row($query);
$message_count = $count[0];
$page_count = ceil($message_count / $page_size);
$offset = ($page - 1) * $page_size;
$result = mysql_query("select * from new_cus_information where inputer = '$inputer' limit $offset, $page_size");
}
else if( isset($_POST["dates"]) && $_POST["dates"] != "") {
$date1 = $_POST["nian1"] . "-" . $_POST["yue1"] . "-" . $_POST["ri1"];
$date2 = $_POST["nian2"] . "-" . $_POST["yue2"] . "-" . $_POST["ri2"];
$query = mysql_query("select count(*) as total from new_cus_information where date between '$date1' and 'date2'");
$count = mysql_fetch_row($query);
$message_count = $count[0];
$page_count = ceil($message_count / $page_size);
$offset = ($page - 1) * $page_size;
$result = mysql_query("select * from new_cus_information where date between '$date1' and '$date2' limit $offset, $page_size");
}
else if( isset($_POST["name"]) && $_POST["name"] != "") {
$name = $_POST['name'];
$query = mysql_query("select count(*) as total from new_cus_information where name = '$name'");
$count = mysql_fetch_row($query);
$message_count = $count[0];
$page_count = ceil($message_count / $page_size);
$offset = ($page - 1) * $page_size;
$result = mysql_query("select * from new_cus_information where name = '$name' limit $offset, $page_size");
}
else if( isset($_POST["sex"]) && $_POST["sex"] != "") {
$id = $_POST['sex'];
$query = mysql_query("select count(*) as total from new_cus_information where sex = '$sex'");
$count = mysql_fetch_row($query);
$message_count = $count[0];
$page_count = ceil($message_count / $page_size);
$offset = ($page - 1) * $page_size;
$result = mysql_query("select * from new_cus_information where sex = '$sex' limit $offset, $page_size");
}
else if( isset($_POST["phone"]) && $_POST["phone"] != "") {
$phone = $_POST['phone'];
$query = mysql_query("select count(*) as total from new_cus_information where phone = '$phone'");
$count = mysql_fetch_row($query);
$message_count = $count[0];
$page_count = ceil($message_count / $page_size);
$offset = ($page - 1) * $page_size;
$result = mysql_query("select * from new_cus_information where phone = '$phone' limit $offset, $page_size");
}
else {
$query = mysql_query("select count(*) as total from new_cus_information");
$count = mysql_fetch_row($query);
$message_count = $count[0];
$page_count = ceil($message_count / $page_size);
$offset = ($page - 1) * $page_size;
$result = mysql_query("select * from new_cus_information limit $offset, $page_size");
}
}
while($row=mysql_fetch_array($result)) {
//修改的部分
/*$abc=@iconv("gb2312", "gbk", $abc=$row['0']);**/
$id=$row['0'];
$inputer=$row['1'];
$date=$row['2'];
$name=$row['3'];
$sex=$row['4'];
$phone=$row['5'];
$email=$row['6'];
$address=$row['7'];
$notes=$row['8'];
?>
<tr>
<td height="20" bgcolor="#FFFFFF"><div align="center"><input type="checkbox" name="selectBox" id="selectBox" value="checkbox" /></div></td>
<td height="20" bgcolor="#FFFFFF"><div align="center" class="STYLE1"><div align="center"><?php echo $id ?></div></div></td>
<td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1"><?php echo $inputer ?></span></div></td>
<td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1"><?php echo $date ?></span></div></td>
<td bgcolor="#FFFFFF"><div align="center"><span class="STYLE1"><?php echo $name ?></span></div></td>
<td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1"><?php echo $sex ?></span></div></td>
<td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1"><?php echo $phone ?></span></div></td>
<td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1"><?php echo $email ?></span></div></td>
<td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1"><?php echo $address ?></span></div></td>
<td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1"><?php echo $notes ?></span></div></td>
<td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE4">
<input type=image name="edit" src=images/edt.gif onclick="SelSubmit2()" value="<?php echo $id ?>">编辑
<input type=image name="delete" src=images/del.gif onclick="SelSubmit3()" value="<?php echo $id ?>">删除
</span></div></td>
</tr>
<?php } ?>
</table></td>
<td width="8" background="images/tab_15.gif"> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="35" background="images/tab_19.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="12" height="35"><img src="images/tab_18.gif" width="12" height="35" /></td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="STYLE4"> 共有 <?php echo $message_count ?> 条记录,当前第 <?php echo $page ?>/<?php echo $page_count ?> 页</td>
<td><table border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td width="40"><input name="page" type=image src=images/first.gif onclick="SelSubmit1()" value="1"></td>
<td width="45"><input name="page" type=image src=images/back.gif onclick="SelSubmit1()" value="<?php echo ($page - 1) ?>"></td>
<td width="45"><input name="page" type=image src=images/next.gif onclick="SelSubmit1()" value="<?php echo ($page + 1) ?>"></td>
<td width="40"><input name="page" type=image src=images/last.gif onclick="SelSubmit1()" value="<?php echo $page_count ?>"></td>
<td width="100"><div align="center"><span class="STYLE1">转到第
<input name="page" type="text" size="4" style="height:12px; width:20px; border:1px solid #999999;" />
页 </span></div></td>
<td width="40"><input type=image src=images/go.gif onclick="SelSubmit1()"></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="16"><img src="images/tab_20.gif" width="16" height="35" /></td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
</html>
[/code]
如代码所示,我在查询窗体id_view.html通过输入id执行完查询动作,如何能返回父窗体tab.php显示出查询结果?
<form method="post" action="../tab/tab.php">
<p>按记录序号(ID)查询:
<input name="id" type="text" >
</p>
<p>
<input name="Submit" type="submit" value="查询" >
</p>
</form>
</div>
tab.php:<?php
include("../conn_mysql.php");//连接数据库的命令 if( isset($_POST["page"]) && $_POST["page"] != "") {
$page = $_POST['page'];
}
if($page == "") {
$page = 1;
}
if(is_numeric($page)) {
$page_size = 15; //每页多少条数据
if( isset($_POST["id"]) && $_POST["id"] != "") {
$id = $_POST['id'];
$query = mysql_query("select count(*) as total from new_cus_information where id = '$id'");
$count = mysql_fetch_row($query);
$message_count = $count[0];
$page_count = ceil($message_count / $page_size);
$offset = ($page - 1) * $page_size;
$result = mysql_query("select * from new_cus_information where id = '$id' limit $offset, $page_size");
}
else {
$query = mysql_query("select count(*) as total from new_cus_information");
$count = mysql_fetch_row($query);
$message_count = $count[0];
$page_count = ceil($message_count / $page_size);
$offset = ($page - 1) * $page_size;
$result = mysql_query("select * from new_cus_information limit $offset, $page_size");
}
}
while($row=mysql_fetch_array($result)) {
//修改的部分
/*$abc=@iconv("gb2312", "gbk", $abc=$row['0']);**/
$id=$row['0'];
$inputer=$row['1'];
$date=$row['2'];
$name=$row['3'];
$sex=$row['4'];
$phone=$row['5'];
$email=$row['6'];
$address=$row['7'];
$notes=$row['8'];
?> 刚刚没写好,我重新写一遍。
如代码所示,我在查询窗体id_view.html通过输入id执行完查询动作,如何能返回父窗体tab.php显示出查询结果?
是否需要在id_view.html上通过js控制查询结果的显示?