急求PHP分页赋值问题....大大帮助解决一下.....在线等了给分附代码等待5个小时了还没解决 大家帮帮忙
<sousuoxianshi.PHP>
<div id="connent"><div id="sousuo"><form method="get" name="form1" target="_blank" id="form1" action="/MPY/ZML/sousuoxianshi2.php?md=<?php echo $key; ?>">
<table width="965" border="0">
<tr>
<td width="59%">
<div align="right">
<input name="key" type="text" class="bluebuttoncss" id="key" style="width:380px" size="12" />
</div></td>
<td width="9%"><input name="Submit" type="submit" class="bluebuttoncss" value="名片搜索" style="height:34px" /></td>
<td width="32%"><span class="STYLE3">(搜索名片中相关分类 如:家政,房地产等)</span></td>
</tr>
</table>
<?php
$conn=mysql_connect("localhost","root","toma123") or die("连接错误");
mysql_select_db("cs",$conn);
mysql_query("set names 'GBK'");
mysql_query("set characher set gb2312");
mysql_query("set names gb2312");
$key = $_GET['key'];
?>
<sousuoxianshi2.php>
<p>
<?php
$conn=mysql_connect("localhost","root","toma123") or die("连接错误");
mysql_select_db("cs",$conn);
mysql_query("set names 'GBK'");
mysql_query("set characher set gb2312");
mysql_query("set names gb2312");
$md=$_GET['key'];
if($md!=""){
$sql="select * from ud8 where title like '%$md%'";
$result=mysql_query($sql);
$sst=mysql_fetch_array($result);
$num=mysql_num_rows($result); //统计行数
$pages=ceil($num/8); //总页数
$page=$_GET['page']; //获得page,如果没有设置或者page=0,把$page=1;
if($page=="")
{
$page=1;
}
$start=($page-1)*8;
$sql="select * from ud8 where title like '%$md%' limit ".$start.",". 8;
$query=mysql_query($sql);
while($sumpage=mysql_fetch_array($query)){
$id=$sumpage['id'];
$dd=$id;
?>
<form id="form2" name="form2" method="post" action="/MPY/ZML/ck.php?dd=<?php echo $sumpage['id']?>">
<table width="965" height="30">
<tr>
<td width="161" height="11" bgcolor="#f0f0f0"><div align="center">公司名称</div></td>
<td width="242" height="11" bgcolor="#f0f0f0"><div align="center">业务介绍</div></td>
<td width="321" height="11" bgcolor="#f0f0f0"><div align="center">图片缩略图</div></td>
<td width="221" height="11" bgcolor="#f0f0f0"><div align="center">查看名片</div></td>
</tr>
<tr>
<td width="161" height="12"><div align="center"><?php echo $sumpage['title'];?></div></td>
<td height="12"><div align="center"><?php echo $sumpage['conne'];?></div></td>
<td width="321" height="12"><div align="center"><?php echo "<img src=\"".$sumpage['TP']."\" hight=\"300\" width=\"262\" / >"; ?></div></td>
<td width="221" height="12"><div align="center" class="STYLE2"><a href="del.php?id=<?php echo $id ?>"></a>
<input name="Submit2" type="submit" class="bluebuttoncss" value="用点数查看名片" />
</div></td>
</tr>
<tr></tr>
</table>
</form>
<?php
$sd=1;
}
$id=$sumpage['id'];
if($num!=0)
{
if($page!=1)
{
"<a href=?page=1>首页</a>";
}else
{
"首页\t";
}
if($page>1)
{
"<a href=?page=".($page-1).">上一页</a>\t";
}else
{
"上一页\t";
}
if($page<$pages)
{
"<a href=?page=".($page+1).">下一页</a>\t";
}else
{
"下一页\t";
}
if($page!=$pages)
{
"<a href=?page=".$pages.">尾页</a>\t";
}else
{
"尾页\t";
}
}else{
"目前没有记录!!";
}
}
?>
<?php echo $page ,$md?>
<table width="50%" border="0" align="center">
<tr>
<td width="10%"><div align="center"><?php echo "共".$pages."页" ?></div></td>
<td width="22%"><div align="center"><?php echo "<a href=?page=1&md={$_GET['key']}>首页</a>" ?></div></td>
<td width="17%"><div align="center">
<?php if($page>1){ echo "<a href=?page=".($page-1)."&md={$_GET['key']}>上一页</a>\t";}else{echo "上一页\t";}?>
</div></td>
<td width="19%"><div align="center">
<?php if($page<$pages){ echo "<a href=?page=".($page+1)."&md={$_GET['key']}>下一页</a>\t";}else{echo "下一页\t";}?>
</div></td>
<td width="16%"><div align="center">
<?php if($page!=$pages){ echo "<a href=?page=".$pages."&md={$_GET['key']}>尾页</a>\t";}else{echo "尾页\t";}?>
</div></td>
<td width="16%">共有<?php echo $num;if($num==""){ echo "0";} ?>名片</td>
</tr>
</table>
提交一次在sousuoxianshi2.PHP中可以现实出来.点击下一页key传值过来的$md变量消失了... 赋值是中文..新手希望能说的详细点......
[解决办法]
形如 echo "<a href=?page=".($page-1)."&md={$_GET['key']}> 这样的代码要改成
形如 echo "<a href=?page=".($page-1)."&key=$md> 这样的