PHP开发简单新闻发布系统之新... 登录

PHP开发简单新闻发布系统之新闻发布前端页面

在前一节我们创建好了数据库和表,做了一些前期的准备工作,这一节我们就要做一个简单添加新闻页面

添加新闻就是向数据库里面添加数据,并在后面新闻列表页面展示。

1604.png

管理员在表单中填写新闻的内容,包括: 标题title, 作者author, 内容content 。

使用<form>表单<input>文本框来输入内容。

页面中<textarea></textarea> 中的内容是用来得到 content 字段内容的,因为此字段中的内容太多,所以只能用这个标签了。

下面是简单的新闻发布页的HTML代码:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>新闻发布页面</title>
    <style type="text/css">
        span{display:inline-block; float: left; width: 55px}
        input[type="submit"]{margin-left: 30%;}
    </style>
</head>
<body bgcolor="#ccc">
    <form name="article" method="post" action="publish.php" style="">
        <h3 style="margin-left: 60px;">新闻发布页面</h3>
        标 题:<input type="text" name="title" style="width:200px"/>
        <br/><br/>
        作 者: <input type="text" name="author" style="width:200px"/>
        <br/><br/>
        <span>内 容:</span>
        <textarea cols=35 rows=8 name="content"></textarea><br/><br/>
        <input type="submit" value="发布新闻"/>
    </form>
</body>
</html>

可以把这个页面命名为:new.php

下一节
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>新闻发布页面</title> <style type="text/css"> span{display:inline-block; float: left; width: 55px} input[type="submit"]{margin-left: 30%;} </style> </head> <body bgcolor="#ccc"> <form name="article" method="post" action="publish.php" style=""> <h3 style="margin-left: 60px;">新闻发布页面</h3> 标 题:<input type="text" name="title" style="width:200px"/> <br/><br/> 作 者: <input type="text" name="author" style="width:200px"/> <br/><br/> <span>内 容:</span> <textarea cols=35 rows=8 name="content"></textarea><br/><br/> <input type="submit" value="发布新闻"/> </form> </body> </html>
提交 重置代码
章节 评论 笔记 课件
  • 取消 回复 发送
  • 取消 发布笔记 发送