一、文章发布界面
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>无标题文档</title>
<style type="text/css">
body{
margin-left:0px;
margin-top: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="#FFF99"><strong>后台管理系统</strong></td>
</tr>
<tr>
<td width="156" height="287" align="left" valign="top" bgcolor="#FFF99"><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="837" valign="top" bgcolor="#FFFFFF">
<form id="form1" name="form1" method="post" action="article.add.handle.php">
<table width="779" border="0" cellpadding="8" cellspacing="1">
<tr>
<td colspan="2" align="center">发布文章</td>
</tr>
<tr>
<td width="625">标题</td>
<td width="625"><label for="title"></label>
<input type="text" name="title" id="title"></td>
</tr>
<tr>
<td>作者</td>
<td><input type="text" name="auther" id="auther"></input></td>
</tr>
<tr>
<td>简介</td>
<td><label for="description"></label>
<textarea name="description" id="description" cols="60" rows="5"></textarea><td>
</tr>
<tr>
<td>内容</td>
<td><textarea name="content" id="content" cols="60" rows="15"></textarea></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" name="button" value="提交"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
二、文章发布程序
<?php
require_once('../connect.php');
//把传递过来的信息入库
//print_r($_POST);
if(!(isset($_POST['title'])&&(!empty($_POST['title'])))){
echo "<script>alert('标题不能为空');window.location.herf='article.add.php'</script>";
}
$title=$_POST['title'];
$auther=$_POST['auther'];
$description=$_POST['description'];
$content=$_POST['content'];
$dateline=time();
$insertsql="insert into article(title,auther,description,content,dateline) values('$title','$auther','$description','$content',$dateline)";
//echo $insertsql;
if(mysql_query($insertsql)){
echo "<script>alert('发布文章成功');window.location.href='article.add.php'</script>";
}else{
echo "<script>alert('发布失败');window.location.href='article.add.php'</script>";
}
?>