有什么错误信息?数据库里有没有数据? $sql="insert into guestbook(name,fromcity,email,content,time) values($name,$fromcity,$email,$content,$time)"; 改成: $sql="insert into `guestbook` (`name`,`fromcity`,`email`,`content`,`time`) values('$name','$fromcity','$email','$content','$time')";
那个sql到数据库里面去执行下,看下是否能正确执行
if($submit && $name && $content)--------------------------------------------you may not get the posted data here:$submit,...use $_POST['submit']...if($_POST['submit'] && $_POST['name'] && $_POST['content'])or write $name=$_POST['submit']; .... on the top of the php program.
$sql="insert into guestbook(name,fromcity,email,content,time) values($name,$fromcity,$email,$content,$time)";
改成:
$sql="insert into `guestbook` (`name`,`fromcity`,`email`,`content`,`time`) values('$name','$fromcity','$email','$content','$time')";