Php中一个用户评论的有关问题

WBOY
Release: 2016-06-13 11:09:22
Original
783 people have browsed it

Php中一个用户评论的问题
我写了一个程序,用户可以对提交的文章做评论,代码如下,



<script><br /> //<!--做判断<br /> function InputCheck(RegForm)<br /> {<br /> <br /> if (RegForm.comment.value == "")<br /> {<br /> alert("评论内容不可为空!");<br /> RegForm.comment.focus();<br /> return (false);<br /> }<br /> <br /> }<br /> </script>



session_start();
//检测是否登录,若没登录则转向登录界面
if(!isset($_SESSION['userid'])){
    header("Location:login.html");
    exit();
}
include("menu.php");
echo "返回主页";
include("config.php");
$sql="select * from text where id={$_GET['id']}";
$result=mysql_query($sql,$conn);
echo "
";
if($row=mysql_fetch_assoc($result)){
 echo $row['title'];
 echo "
";
 echo "作者:".$row['author'];
 echo "发表日期:".date("Y-m-d h:m:s",$row['time']);
 echo "


";
 echo $row['article'];
 echo "


";
}else{
 echo "该文章不存在";
}
?>

         
         
              
              
         
  
         
              
         
         
    
评论  





想知道怎么把Php代码中的$row["id"]传址到doComment.php中,使他在doComment.php中能够被调用,求各位大神指教
------解决方案--------------------
action="doComment.php?id=" 
doComment.php页面里使用$_GET['id']取得。
或在表单里放个隐藏text的input值为$row["id"]
------解决方案--------------------
引用:
action="doComment.php?id=" 
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template