這是一頁(yè)留言板塊的代碼,出現(xiàn)的問(wèn)題是賬戶登錄了,然后寫了留言標(biāo)題和內(nèi)容,但是提交后顯示失敗了,不知道哪里出錯(cuò)了,希望各位大神能教教我,謝謝!
<?php require("header.php"); if($_SESSION[username]=="") { echo "<script>alert('請(qǐng)先登錄');history.back();</script>"; exit; } if($act=="save") { if($title=="" || $content=="") { echo "<script>alert('留言標(biāo)題,內(nèi)容,不能為空');history.back();</script>"; exit; } $sql="insert into liuyan (title,content,userid) values ('$title','$content','$_SESSION[username]')"; $res=mysql_query($sql); if($res) { echo "<script>alert('成功');location.href='guest.php';</script>"; exit; } else exit("失敗了"); } ?>
上面是留言數(shù)據(jù)表的內(nèi)容
沒(méi)有連接mysql,沒(méi)有選擇數(shù)據(jù)庫(kù)