搜索不起作用,好像没有传递过来值,帮我看看代码:\
<?
@session_start();
require('system/inc/db_conn.php');
require('inc/pageft.php');
$conn = $db->conn_open();
?>
<?
//获取搜索关键字
$keyword=trim($_POST[“keyword”]);
//检查是否为空
if($keyword==””){
echo”您要搜索的关键字不能为空”;
exit;//结束程序
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<LINK href="images/css.css" type=text/css rel=stylesheet>
<title>111111111111--Products</title>
</head><body>
<?require"top.php";
?>
<table width="948" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="248" height="4"></td>
<td width="3"></td>
<td width="697"></td>
</tr>
<tr>
<td rowspan="2" valign="top">
<? require("left.php");?>
</td>
<td> </td>
<td rowspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="697" height="25" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/goods_head.gif">
<!--DWLayoutTable-->
<tr>
<td width="12" height="25"> </td>
<td width="680" align="left" valign="middle" class="leftmenu">Products
<?
if(empty($_GET['Bid'])&&empty($_GET['Sid']))
{
echo "";
}else if($_GET['Sid']!="")
{
echo "><a href=Products.php?Bid=".$_GET['Bid']." class=login2>".$db->GetSortName($_GET['Bid'],$conn)."</a>><a href=Products.php?Bid=".$_GET['Bid']."&Sid=".$_GET['Sid']." class=login2>".$db->GetSortName($_GET['Sid'],$conn)."</a>";
}else{
echo "><a href=Products.php?Bid=".$_GET['Bid']." class=login2>".$db->GetSortName($_GET['Bid'],$conn)."</a>";
}
?>
</td>
<td width="5"></td>
</tr>
</table></td>
</tr>
<tr>
<td width="697" height="25" valign="top" style="padding-top:10px"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="25" align="left" style="padding-left:20px"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<?php if(empty($_GET['Bid'])&&empty($_GET['Sid']))
{
$strq=" ";
}else if($_GET['Sid']!="")
{
$strq=" and sortid=".$_GET['Sid']."";
}else{
$strq=" and (sortid in(select sortid from sql_sys_sort where sort_fsid=".$_GET['Bid'].") or sortid=".$_GET['Bid'].")";
}
$sql="select * from sq_class where 1=1 and class_title like '%$keyword%' ".$strq;
$total=mysql_num_rows(mysql_query($sql,$conn));
$displaypg=20;
pageft($total,$displaypg,"Products.php?Bid=".$_GET['Bid']."&Sid=".$_GET['Sid']."");
$page=$_REQUEST["page"];
if(empty($page)) $page=1;
$firstcount=($page-1)*$displaypg;
$sql="select * from sq_class where 1=1 and class_title like '%$keyword%' ".$strq." order by class_order desc limit $firstcount, $displaypg";
//echo $sql;
$result=$db->query($sql,$conn);
$row=$db->num_rows($result);
for ($i=0;$i<$row;$i++){
$rs=$db->fetch_array($result,MYSQL_BOTH);
?> <td><table width="697" border="0" cellpadding="0" cellspacing="0" style="border-bottom:1px solid #fcd163; ">
<!--DWLayoutTable-->
<tr>
<td width="190" rowspan="7" align="center" valign="top"><a href="product_preview.php?PID=<?=$rs["class_id"]?>" target="_blank"><img src="<?=$rs["class_photoa"]?>" width="180" height="150" border="0" /></a></td>
<td width="507" height="25" align="left" valign="middle"><a href="product_preview.php?PID=<?=$rs["class_id"]?>" target="_blank" class="login2"><font color="#0000de"><strong><? echo $str->sub_str($rs["class_title"],80)?></strong></font></a></td>
</tr>
<tr>
<td height="25" align="left" valign="middle">Price:$ <?=$rs["price"]?></td>
</tr>
<tr>
<td height="25" align="left" valign="middle">Shipping costs: <? echo $str->sub_str($rs["class_Shipping"],80)?></td>
</tr>
<tr>
<td height="25" align="left" valign="middle">item location: <? echo $str->sub_str($rs["class_location"],80)?></td>
</tr>
<tr>
<td height="25" align="left" valign="middle">Ships to: <? echo $str->sub_str($rs["class_Ships"],80)?></td>
</tr>
<tr>
<td height="11"></td>
</tr>
<tr>
<form action="savecart.php" method="post" target="_blank">
<td height="24" align="right" valign="middle"><input type="image" src="images/buy.gif" width="39" height="22" name="Submit" value="提交" /> <a href="book.php?PID=<?=$rs["class_id"]?>"><img src="images/Favorite.gif" width="67" height="22" border="0" /></a>
<input name="productid" type="hidden" id="productid" value="<?=$rs["class_id"]?>" />
<input name="productname" type="hidden" id="productname" value="<?=$rs["class_title"]?>" />
<input name="productno" type="hidden" id="productno" value="<?=$rs["model"]?>" />
<input name="productprice" type="hidden" id="productprice" value="<?=$rs["price"]?>" /> <form> </td>
</tr>
</table><br /></td>
<?
if(($i+1)%1==0)
echo"</tr><tr>";
}
?>
</tr>
</table>
<table width="697" border="0" cellpadding="0" cellspacing="0" >
<!--DWLayoutTable-->
<tr>
<td width="697" height="42" align="center" valign="middle"><?=$pagenav?></td>
</tr>
</table>
</td>
<td width="5"></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table><? require"end.php";?>
<?
@session_start();
require('system/inc/db_conn.php');
require('inc/pageft.php');
$conn = $db->conn_open();
?>
<?
//获取搜索关键字
$keyword=trim($_POST[“keyword”]);
//检查是否为空
if($keyword==””){
echo”您要搜索的关键字不能为空”;
exit;//结束程序
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<LINK href="images/css.css" type=text/css rel=stylesheet>
<title>111111111111--Products</title>
</head><body>
<?require"top.php";
?>
<table width="948" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="248" height="4"></td>
<td width="3"></td>
<td width="697"></td>
</tr>
<tr>
<td rowspan="2" valign="top">
<? require("left.php");?>
</td>
<td> </td>
<td rowspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="697" height="25" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/goods_head.gif">
<!--DWLayoutTable-->
<tr>
<td width="12" height="25"> </td>
<td width="680" align="left" valign="middle" class="leftmenu">Products
<?
if(empty($_GET['Bid'])&&empty($_GET['Sid']))
{
echo "";
}else if($_GET['Sid']!="")
{
echo "><a href=Products.php?Bid=".$_GET['Bid']." class=login2>".$db->GetSortName($_GET['Bid'],$conn)."</a>><a href=Products.php?Bid=".$_GET['Bid']."&Sid=".$_GET['Sid']." class=login2>".$db->GetSortName($_GET['Sid'],$conn)."</a>";
}else{
echo "><a href=Products.php?Bid=".$_GET['Bid']." class=login2>".$db->GetSortName($_GET['Bid'],$conn)."</a>";
}
?>
</td>
<td width="5"></td>
</tr>
</table></td>
</tr>
<tr>
<td width="697" height="25" valign="top" style="padding-top:10px"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="25" align="left" style="padding-left:20px"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<?php if(empty($_GET['Bid'])&&empty($_GET['Sid']))
{
$strq=" ";
}else if($_GET['Sid']!="")
{
$strq=" and sortid=".$_GET['Sid']."";
}else{
$strq=" and (sortid in(select sortid from sql_sys_sort where sort_fsid=".$_GET['Bid'].") or sortid=".$_GET['Bid'].")";
}
$sql="select * from sq_class where 1=1 and class_title like '%$keyword%' ".$strq;
$total=mysql_num_rows(mysql_query($sql,$conn));
$displaypg=20;
pageft($total,$displaypg,"Products.php?Bid=".$_GET['Bid']."&Sid=".$_GET['Sid']."");
$page=$_REQUEST["page"];
if(empty($page)) $page=1;
$firstcount=($page-1)*$displaypg;
$sql="select * from sq_class where 1=1 and class_title like '%$keyword%' ".$strq." order by class_order desc limit $firstcount, $displaypg";
//echo $sql;
$result=$db->query($sql,$conn);
$row=$db->num_rows($result);
for ($i=0;$i<$row;$i++){
$rs=$db->fetch_array($result,MYSQL_BOTH);
?> <td><table width="697" border="0" cellpadding="0" cellspacing="0" style="border-bottom:1px solid #fcd163; ">
<!--DWLayoutTable-->
<tr>
<td width="190" rowspan="7" align="center" valign="top"><a href="product_preview.php?PID=<?=$rs["class_id"]?>" target="_blank"><img src="<?=$rs["class_photoa"]?>" width="180" height="150" border="0" /></a></td>
<td width="507" height="25" align="left" valign="middle"><a href="product_preview.php?PID=<?=$rs["class_id"]?>" target="_blank" class="login2"><font color="#0000de"><strong><? echo $str->sub_str($rs["class_title"],80)?></strong></font></a></td>
</tr>
<tr>
<td height="25" align="left" valign="middle">Price:$ <?=$rs["price"]?></td>
</tr>
<tr>
<td height="25" align="left" valign="middle">Shipping costs: <? echo $str->sub_str($rs["class_Shipping"],80)?></td>
</tr>
<tr>
<td height="25" align="left" valign="middle">item location: <? echo $str->sub_str($rs["class_location"],80)?></td>
</tr>
<tr>
<td height="25" align="left" valign="middle">Ships to: <? echo $str->sub_str($rs["class_Ships"],80)?></td>
</tr>
<tr>
<td height="11"></td>
</tr>
<tr>
<form action="savecart.php" method="post" target="_blank">
<td height="24" align="right" valign="middle"><input type="image" src="images/buy.gif" width="39" height="22" name="Submit" value="提交" /> <a href="book.php?PID=<?=$rs["class_id"]?>"><img src="images/Favorite.gif" width="67" height="22" border="0" /></a>
<input name="productid" type="hidden" id="productid" value="<?=$rs["class_id"]?>" />
<input name="productname" type="hidden" id="productname" value="<?=$rs["class_title"]?>" />
<input name="productno" type="hidden" id="productno" value="<?=$rs["model"]?>" />
<input name="productprice" type="hidden" id="productprice" value="<?=$rs["price"]?>" /> <form> </td>
</tr>
</table><br /></td>
<?
if(($i+1)%1==0)
echo"</tr><tr>";
}
?>
</tr>
</table>
<table width="697" border="0" cellpadding="0" cellspacing="0" >
<!--DWLayoutTable-->
<tr>
<td width="697" height="42" align="center" valign="middle"><?=$pagenav?></td>
</tr>
</table>
</td>
<td width="5"></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table><? require"end.php";?>
echo”您要搜索的关键字不能为空”; 这里的也是,检查一下你的引号使用
在echo $a ;
自己一步步验证,就知道哪没有值了