我嘗試寫的代碼,你可以通過一個的fancybox iframe中更新數據庫
我的代碼犯規裏面的表單更新數據庫的內容似乎即使顯示沒有錯誤工作。數據庫沒有更新
這裏是我的代碼
editschool.php(這是我的fancybox iframe的內容)
<?php
$temp = mysql_query("SELECT * from tertiary_school where tschool_id = $_GET[tschool_id]");
$temp = mysql_fetch_array($temp);
?>
<center>
<form class="form-inline" method = 'post' enctype="multipart/form-data">
<table>
<tr>
<td width="40%">
Edit School Name:
</td>
<td>
<input name = "tschool_name" type="text" class="input-xlarge" id = "tschool_name" value="<?php echo $temp[tschool_name]; ?>"><button type="submit" value = "submit" name = "submit" class="btn btn-primary" onclick="event.preventDefault(); parent.$.fancybox.close();">Save Changes</button>
</td>
</tr>
</table>
</form>
</center>
<?php
if(isset($_POST['submit']))
{
$tschool_name = $_POST['tschool_name'];
$tschool_id = $_GET['tschool_id'];
mysql_query("UPDATE tertiary_school SET tschool_name=$tschool_name WHERE tschool_id=$tschool_id") or die(mysql_error());
}
?>
在此先感謝
嘗試呼應'$ tschool_name'和'$ tschool_id' – Ravi
我沒有和正確的數據就出來了。 現在我的問題是爲什麼它不更新我的數據庫? 我是否需要在我的代碼中添加某種父標籤? – itsover9000
如果一切越來越細見下文 – Ravi