留言板回覆 寫入問題

edited 七月 2014 in PHP新手區
<?php include ("insideNav.php")?>
<?php include("counter.php");
 include("mysql_connect.inc.php");
 ?>
 <?php 
 $sql="select * from guestbook where num='".$_GET['pid']."' ";
 $result = mysql_query($sql);
 $row = mysql_fetch_row($result);
 ?>

<!Doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="stylesheet"   type="text/css"  href="style.css">
		<script type="text/javascript" src="time.js"></script>
</head>
<body	 onload="ShowTime()">
		<div		id="wrap">
		<div		id="head">
		</div>
		<div		id="content">
		<div		id="sideNav">
			<?php insideNav(7)?>
		</div>
		<div		id="main" >
	  		
	  	 
	  	 <?php 
	  	echo " <form method=\"POST\"  name=\"form1\" action=\"reply.php\">";
	  	echo " ID:<input type=\"text\" value=\"jackjow\" ><br>";
	  	echo "內容:<textarea name=\"main\" cols=\"45\" rows=\"6\" required ></textarea><br>";
	  	echo "<input type=\"submit\" value=\"送出\" > ";
	  	echo "<input type=\"reset\" value=\"reset\" >";
	  	echo "</form>";
	  	 		
	  	 		
				date_default_timezone_set(' Asia/Taipei ');
				
				
				$name=$_POST['name'];
				$reply=$_POST['reply'];
				$num=$_POST['num'];
				
				if (isset($reply)){
				
				
				$sql2="insert  into `res` set  name='".$name."',reply='".$reply."',num='".$row['0']."',time='".date("Y-m-d h:i:s" )."'  ";		
					
				echo "$sql2";

				
				if(mysql_query($sql2) ){
					echo '已成功回覆留言<br>';
					echo '<meta http-equiv="refresh" content="1 ; url=msg.php"/>';
				}else{
					echo '無法回覆留言<br>';
				}
			}
				
			?>
	  
		</div>
		</div>
		<div		id="foot">

		<?php cnt();?>
		<div id="showbox"></div>
		</div>
		</div>
</body>
</html>
Sign In or Register to comment.