我正在尝试编写代码,您可以在其中通过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());
}
?>
提前致谢