PHP信息修改并提交页面,以下是我的代码,可以读取数据,但修改后,点击发布,数据库信息却没变动,请指点
请高手指点,在线等。<?phpinclude("../check.php");if(!empty($_POST['sub'])){$sql="updatezntltd_q...
请高手指点,在线等。
<?php
include("../check.php");
if(!empty($_POST['sub'])){
$sql="update zntltd_qb_menu set name='".$_POST['name']."' , linkurl='".$_POST['linkurl']."', fid='".$_POST['fid']."' where id='".$_POST['id']."'";
mysql_query($sql);
echo "<script>alert('修改成功!');location.href='list.php'</script>";
exit();
}
$sql="SELECT id,name,linkurl,fid FROM `zntltd_qb_menu` WHERE id=".$_GET['id']." order by id desc";
$query=mysql_query($sql);
$rs=mysql_fetch_array($query);
?>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<form action="" method="post">
菜单名称<input name="name" type="text" size="20" value="<?php echo $rs['name'] ?>"><br>
链接地址<input name="linkurl" type="text" size="20" value="<?php echo $rs['linkurl'] ?>"><br>
顺序排序<input name="fid" type="text" size="20" value="<?php echo $rs['fid'] ?>"><br>
<input type="submit" name="sub" value="发布"><br>
</form>
check.php 文件
<?php
include("config/conn.php");
empty($_COOKIE['uid'])? exit : null;
$rs=$db->login_check($_COOKIE['uid'],$_COOKIE['keyid']);
$row=$db->select_once("user_info","`uid`='".$rs[0]."'");
if(!empty($_GET['login'])){
$db->login_out("../index.php");
}
empty($_COOKIE['uid'])? exit : null;
$rs=$db->login_check($_COOKIE['uid'],$_COOKIE['keyid']);
?>
conn.php文件为连接数据库信息 展开
<?php
include("../check.php");
if(!empty($_POST['sub'])){
$sql="update zntltd_qb_menu set name='".$_POST['name']."' , linkurl='".$_POST['linkurl']."', fid='".$_POST['fid']."' where id='".$_POST['id']."'";
mysql_query($sql);
echo "<script>alert('修改成功!');location.href='list.php'</script>";
exit();
}
$sql="SELECT id,name,linkurl,fid FROM `zntltd_qb_menu` WHERE id=".$_GET['id']." order by id desc";
$query=mysql_query($sql);
$rs=mysql_fetch_array($query);
?>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<form action="" method="post">
菜单名称<input name="name" type="text" size="20" value="<?php echo $rs['name'] ?>"><br>
链接地址<input name="linkurl" type="text" size="20" value="<?php echo $rs['linkurl'] ?>"><br>
顺序排序<input name="fid" type="text" size="20" value="<?php echo $rs['fid'] ?>"><br>
<input type="submit" name="sub" value="发布"><br>
</form>
check.php 文件
<?php
include("config/conn.php");
empty($_COOKIE['uid'])? exit : null;
$rs=$db->login_check($_COOKIE['uid'],$_COOKIE['keyid']);
$row=$db->select_once("user_info","`uid`='".$rs[0]."'");
if(!empty($_GET['login'])){
$db->login_out("../index.php");
}
empty($_COOKIE['uid'])? exit : null;
$rs=$db->login_check($_COOKIE['uid'],$_COOKIE['keyid']);
?>
conn.php文件为连接数据库信息 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询