这是我的表格:
<div id="HomeAgenda">
<div id="HomeAgendaTitle">Agenda</div>
<div id="HomeAgendaCreate">
<form method="post" action="#">
<input type="text" name="HomeAgendaCreateTitle" id="HomeAgendaCreateTitle" placeholder="Subject" /><br>
<input type="text" name="HomeAgendaCreateLocation" id="HomeAgendaCreateLocation" placeholder="Location" /><br>
<input type="text" name="HomeAgendaCreateDate" id="HomeAgendaCreateDate" placeholder="Date" />
<input type="text" name="HomeAgendaCreateTime" id="HomeAgendaCreateTime" placeholder="Time" /><br>
<input type="text" name="HomeAgendaCreateNotes" id="HomeAgendaCreateNotes" placeholder="Notes" />
<input type="submit" name="HomeAgendaCreateSubmit" id="HomeAgendaCreateSubmit" value="Save" />
</form>
</div>
</div>
这是我的 php:
<?php
$SetAgendaAppointment = @$_POST['HomeAgendaCreateSubmit'];
$SetAgendaTitle = @$_POST['HomeAgendaCreateTitle'];
$SetAgendaLocation = @$_POST['HomeAgendaCreateLocation'];
$SetAgendaDate = @$_POST['HomeAgendaCreateDate'];
$SetAgendaTime = @$_POST['HomeAgendaCreateTime'];
$SetAgendaNotes = @$_POST['HomeAgendaCreateNotes'];
if($SetAgendaAppointment) {
mysql_query("INSERT INTO agenda VALUES('$SetAgendaTitle','$SetAgendaLocation','$SetAgendaDate','$SetAgendaTime','$SetAgendaNotes','$user_id')");
}
?>
这是我的数据库连接代码:
<?php
mysql_connect("localhost","root","250317") or die(mysql_error());
mysql_select_db("bakpakk");
?>
在我提交表单中的信息后,在我的页面上,没有任何反应。当我检查议程表时,没有提交任何内容,并且 phpmyadmin 在表中返回零行。我似乎无法弄清楚为什么?提交数据后,如果表中已有任何数据,则不再将数据输入表中。任何帮助将不胜感激。