简单文章发布系统(4)

一、文章修改界面

<?php 
	require_once('../connect.php');
	//读取旧信息
	$id=$_GET['id'];
	$query=mysql_query("select * from article where id=$id");//产生结果集
	$data=mysql_fetch_assoc($query);
	
?>

<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=utf-8"/ >
<title>无标题文档</title>
<style type="text/css">
body{
	margin-left:0px;
	margin-tip:0px;
	margin-right:0px;
	margin-bottom:0px;
}
</style>
</head>

<body>
<table width="100%" height="520" border="0" cellpadding="8" cellspacing="1" bgcolor="#000000">
	<tr>
		<td height="89" colspan="2" bgcolor="FFFF99"><strong>后台管理系统</strong> </td>
	</tr>
	<tr >
		<td width="213" height="287" align="left" valign="top" bgcolor="#FFFF99"><p><a href="article.add.php">发表文章</a></p>
		<p><a href="article.manage.php">管理文章</a></p> <a href="article.add.php"></a></td>   
		<td width="854" valign="top" bgcolor="#FFFFFF"><form id="form1" name="form1" method="post" action="article.modify.handle.php">
			<input type="hidden" name="id" value="<?php echo $data['id']?>" />
			<table width="590" border="0" cellpadding="8" cellspacing="1">
				<tr>
					<td colspan="2" align="center">修改文章</td>
				</tr>
				<tr>
					<td width="119">标题</td>
					<td width="437"><label for="title"></label>
						<input type="text" name="title" id="title" value="<?php echo $data['title']?>"/> </td>
				</tr>
				<tr>
					<td>作者</td>
					<td><input type="text" name="auther" id="auther" value="<?php echo $data['auther'] ?>"></td>
				</tr>
				<tr>
					<td>简介</td>
					<td><label for="description"></label>
					<textarea name="description" id="description" cols="60" rows="5"><?php echo $data['description']?></textarea></td>
				</tr>
				<tr>
					<td>内容</td>
					<td><textarea name="content" cols="60" rows="20" id="content"><?php echo $data['content']?></textarea></td>
				</tr>
				<tr>
					<td colspan="2" align="right"><input type="submit" name="button" id ="button" value="提交"/></td>
				</tr>
			</table>
		</form></td>
	</tr>
</table>
</body>
</html>


二、文章修改程序

<?php 
	require_once('../connect.php');
	$id=$_POST['id'];
	$title=$_POST['title'];
	$auther=$_POST['auther'];
	$description=$_POST['description'];
	$content=$_POST['content'];
	$dateline=time();
	$updatesql=" update article set title='$title',auther='auther',description='$description',content='$content',dateline=$dateline where id=$id";
	if(mysql_query($updatesql)){
		echo "<script>alert('修改文章成功');window.location.href='article.manage.php'</script>";
	}else{
		echo "<script>alert('修改文章失败');windon.location.href='article.manage.php'</script>";
	}
	
?>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值