我再次。虽然我真的很努力地尝试练习,但我对PHP真的很陌生,所以现在的条款有点儿麻烦。PHP插入表问题
我现在的问题是我的CMS似乎无法将数据提交到MySQL表。这里是我的功能:
function newEntry() {
$query = mysql_query("INSERT INTO entries VALUES(null,'name','description','content')") or die(mysql_error());
}
这里是我的提交内容形式:
<form action="doNewEntry.php" method="post">
<textarea name="entTitle" id="entTitle">Entry Title</textarea><br>
<textarea name="entDesc" id="entDesc">Input Description Here</textarea><br>
<textarea name="entCont" id="entCont">Type and format content here! What you see, is what you get.</textarea><br>
<script>
CKEDITOR.replace('entCont');
</script>
<table><td colspan="2"><input type="submit" name="submit" /></td></table>
</form>
,这里是文件之间的事实,使岗位:
<?php
include('includes/functions.php');
if(isset($_POST['submit'])) {
if(isset($_POST['entTitle'])) {
newEntry($_POST['entTitle'],$_POST['entDesc'],$_POST['entCont']);
header("Location: entries.php");
} else {
echo "Please fill out all fields!";
include('newEntry.php');
}
}
?>
我难以置信新的,所以这无疑是一个非常简单的修复。也许只是错过了一些东西,但我真的无法弄清楚。添加问题。 :(
你通过parame通过newEntry调用,但在newEntry函数中,您没有得到任何参数! –