<?php 
require_once("../include/connect.php");

session_start();
$_SESSION['tid'];

if($tid=$_GET['id']){  //id  - index.php点击链接时左下角出现的一个id
$_SESSION['tid']=$tid;
$query1="select * from title where tID=".$_SESSION['tid'];
$result1=mysql_query($query1);
$row1=mysql_fetch_array($result1);
}elseif(isset($_SESSION['tid'])){
$query1="select * from title where tID=".$_SESSION['tid'];
$result1=mysql_query($query1);
$row1=mysql_fetch_array($result1);
}
if($_POST['Submit']){   //isset-检测变量是否被设置

$rtitle = $_POST['rTitle'];
$rcontent = shield($_POST['rContent']);
$rdate = time();
$rIP = $_SERVER['REMOTE_ADDR'];//获取提交者的ip地址
$tid = $_POST['tid'];//隐藏域的name

$sql1 = "insert into reply values (null,'$rtitle','$rcontent','$rdate','$rIP','$tid')";
mysql_query($sql1);
//echo $sql;
//exit;
//echo "<script>alert('回复成功');</script;
showmsg("回复成功");
}
?>
<!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=gb2312" />
<title>回复主题</title>
<link href="../include/css.css" rel="stylesheet" type="text/css" /></head><body>
<?php head();?>
<table width="600" border="0" align="center">
  <tr>
    <td width="100" rowspan="2" bgcolor="#FFF0FE">&nbsp;</td>
    <td height="30" bgcolor="#FFF7FF">&gt;&gt;当前位置&gt;&gt;<a href="../index.php">首页</a>&gt;&gt;<a href="bbs_index.php">贴吧</a>&gt;&gt;回复贴</td>
  </tr>
  <tr>
    <td height="370" valign="top" class="content1">
<!--             主题贴                  --><table width="500" border="1" align="center" bordercolor="#FED3DF" class="content1">
<caption>主题帖</caption>
  <tr bgcolor="#FEDAF0">
    <td>标题:<?=$row1['tTitle']?></td>
  </tr>
  <tr>
    <td><?=nl2br($row1['tContent'])?></td>
  </tr>
  <tr align="right">
    <td>发表时间:<?=date("Y年n月j日",$row1['tDate'])?>;发帖人:<?=ip($row1['tIP'])?></td>
  </tr>
</table>
<!--             回复贴                  -->
<?php
$query="select * from reply where tID=".$_SESSION['tid'];
if($page = page($db,$query,5)){
while($row = mysql_fetch_array($page[0])){
?>
<table width="500" border="1" align="center" bordercolor="#FDC9BD" class="content2">
<caption>回复贴</caption>
   <tr bgcolor="#FEE3E0">
     <td bgcolor="#FEE3E0">回复标题:<?=$row['rTitle']?></td>
     <td width="50" align="right" bgcolor="#FEE3E0"><span class="formfont">NO:</span><?php echo ++$i + ($_SESSION['pageno']-1)*$_SESSION['pagesize'];?></td>
   </tr>
   <tr>
     <td colspan="2"><?=$row['rContent']?></td>
   </tr>
   <tr>
     <td colspan="2" align="right">回复时间:<?=date("Y年n月j日",$row['rDate'])?>;回复人:<?=ip($row['rIP'])?></td>
   </tr>
  </table> 
<?php 
}
?>
<table width="500" border="1" align="center" bordercolor="#FDC9BD">
  <tr><td align="center" bgcolor="#FEE3E0"><?php echo $page[1];?></td>
  </tr></table>
<?php
}else{
?>
<table width="500" border="1" align="center" bordercolor="#FDC9BD">
  <tr><td align="center" bgcolor="#FEE3E0">没有内容显示</td>
  </tr></table>
<?php
}
?><!--             回复主题                  -->
<form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
  <table width="500" border="1" align="center" bordercolor="#C8D7FB" bgcolor="#F7FBFF" class="content2">
  <caption class="title">回复主题
  </caption>
    <tr>
      <td width="150" height="30" align="right">主题:</td>
      <td height="30"><input type="text" name="rTitle" /></td>
    </tr>
    <tr>
      <td width="150" height="30" align="right">回复内容:</td>
      <td height="30"><textarea name="rContent"></textarea></td>
    </tr>
    <tr>
      <td height="30" colspan="2" align="center"><input type="submit" name="Submit" value="回复提交" />
      <input name="tid" type="hidden" id="tid" value="<?=$row1['tID'];?>"/></td><!--隐藏域-->
    </tr>
  </table>
</form> </td>
  </tr>
</table><?php bottom();?>
</body>
</html>下面的回复主题就是显示不出来,为什么啊~~~~
哪位高手指教一下

解决方案 »

  1.   

          echo   $rtitle = $_POST['rTitle']; //看看这个有内容么 ?
      

  2.   

    <form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
    看一下action后面的地址, 正确不, 是不是你要传值过去的页面
      

  3.   


    第一步   把html里的form提交修改一下<form id="form1" name="form1" method="post" action="这里直接写页面名字, 如, index.php">
    第二步   查看值    require_once("../include/connect.php");
        
        session_start();
        $_SESSION['tid'];
        
        //这里打印所有表单值, 看看
        echo $_GET['id'];
        echo  $rtitle = $_POST['rTitle'];
        .... 第三步, 看你上面两步的检查結果再决定
      

  4.   

    有id,但是我添加了rtitle的value值还是没有显示,那个改成bbs_list.php之后仍然没有回复框
      

  5.   

    在浏览器中查看源文件,看看是PHP页面没有输出回复框还是因为编码等问题导致浏览器没有正确显示?
      

  6.   

    在 if($_POST['Submit']){ 中 var_dump($_POST);打印一下
      

  7.   

    这种测试问题...............,把$row1输出看一下有没有记录集
      

  8.   


    没有显示恢复框?  和源代码和原文件的html相同不 ?
      

  9.   

    在头部写入print_r($_POST);都打印出来,瞧瞧有没有.如果没有就没天理了.:(