21,891
社区成员
发帖
与我相关
我的任务
分享include_once'connect.php';
$id = $_GET[id];
$sql = mysql_query("select * from news where id = $id");
$row = mysql_fetch_object($sql);
?>
<table width="766" border="0">
<tr>
<td width="760" height="31">当前位置----><span class="STYLE1">修改新闻</span></td>
</tr>
<tr>
<td height="32">修改信息如下:</td>
</tr>
</table>
<form name="form1" method="post" action="nchecku.php">
<table width="723" height="478" border="1" bordercolor="#339999">
<tr>
<td width="130" height="42"><div align="center" class="STYLE2">新闻标题:</div></td>
<td width="577"><label>
<input name="biaoti" type="text" value="<?php echo $row->biaoti;?>" size="80">
</label>
<input type="hidden" name="id" value="<?php echo $row->id;?>/></td>
</tr>
<tr>
<td height="51" colspan="2" /></td>
</tr>
<tr>
<td height="340"><div align="center" class="STYLE2"><strong>内容:</strong></div></td>
<td valign="middle"><label>
<textarea name="neirong" cols="80" rows="25" ><?php echo $row->neirong;?></textarea>
</label></td>
</tr>
<tr>
<td height="28"> </td>
<td><label>
<input type="submit" name="xiugai" value="修改" onClick="return checke(form1)" />
</label>
<label>
<input type="reset" name="Submit2" value="取消" />
</label></td>
</tr>
</table>
</form><?php
include_once 'connect.php';
$id = $_POST[id];
$biaoti = $_POST[biaoti];
$neirong = $_POST[neirong];
date_default_timezone_set('PRC');
$ctime = date("Y-m-d H:i:s");
$sql = mysql_query("update news set biaoti='$biaoti',neirong='$neirong',ctime='$ctime' where id = $id");
if($sql){
echo"<script>alert('信息更新成功!');window.location.href ='newschaxun.php';</script>";
}else{
echo"<script>alert('信息更新失败,请重新操作!');window.location.href ='newsupdate.php';</script>";
}
mysql_free_result($sql);
?><?php
$link = mysql_connect("localhost","root","456789")or die ("不能连接到数据库!".mysql.error());
$db = mysql_select_db("work",$link);
mysql_query("set names 'gbk'");
?>
$id = $_GET[id];
//id引号起来再试试?也就是$_GET['id'];