实现后台部分功能
php文件
———————————————————admin文件——————————————————————————————————————————————————————
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>news后台管理</title>
</head>
<frameset rows="15%,*" frameborder="no">
<frame src="logo.php" scrolling="no" />
<frameset cols="20%,*">
<frame src="menu.php" name="logo"/>
<frame src="window.php" name="win" />
</frameset>
</frameset><noframes></noframes>
</html>
——————————————————添加文件——————————————————————————————————————————————————————
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body bgcolor="#99FFCC">
<form action="insert.php" method="post" target="win">
请输入新闻的标题:<input type="text" name="title" /><br />
请选择新闻类型:<select name="c_id"><option value="1">体育</option><option value="2">娱乐</option></select>
<br />
请输入新闻介绍:<br />
<textarea cols="60" rows="15" name="content"></textarea>
<input type="submit" value="提交" />
</form>
</body>
</html>
————————————————往数据库中添加文件代码—————————————————————————————————————————————————
<body bgcolor="#99FFCC"><?php
include("connectmysql.php");
$q = "insert into new(title,content,news_date,news_cate_id) values('".$_POST["title"]."','".$_POST["content"]."',now(),".$_POST["c_id"].")";
mysql_query($q);
if(mysql_affected_rows()>0) echo "新闻添加成功!";
else echo error;
?>
<hr />
<a href="add_news.php" target="win">返回继续添加新闻</a>
</body>