PHP開發(fā)文章發(fā)布系統(tǒng)之後臺(tái)文章修改頁(yè)面
頁(yè)面的大概佈局如下:
#版面介紹:
程式碼如下:
<?php require_once("../connect.php"); $id=$_GET['id']; $SQL="SELECT * FROM article WHERE id=$id"; $query = mysqli_query($conn,$SQL); $data = mysqli_fetch_assoc($query); ?> <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="format-detection" content="telephone=no" /> <title>發(fā)布文章</title> <meta charset="utf-8" /> <style> .box{ background-color:#f0f0f0; } .title{ background-color:#f0f0f0; width:400px; height:100px; border-bottom:1px solid black; } .menu{ margin:-25px 0px 1px 319px; width:80px; } .middle{ border-bottom:1px solid black; } </style> </head> <body> <div class="box"> <div class="title"> <h1>后臺(tái)管理系統(tǒng)</h1> <div class="menu"> <a href="admin_add.php">發(fā)布文章</a><br/> <a href="admin_manage.php">管理文章</a> </div> </div> <div class="middle"> <form method="post" action="admin_modify_handle.php"> <input type="hidden" name="id" value="<?php echo $data['id']?>" /> <div><h2>修改文章</h2></div> <div>標(biāo)題:<input type="text" name="title" value="<?php echo $data['title']; ?>"/></div><br/> <div>作者:<input type="text" name="author" value="<?php echo $data['author']; ?>"/></div><br/> <div>簡(jiǎn)介:<br/><textarea name="description" cols="50" rows="4"><?php echo $data['description']; ?></textarea></div><br/> <div>內(nèi)容:<br/><textarea name="content" cols="50" rows="9" ><?php echo $data['content']; ?></textarea></div><br/> <div><input type="submit" name="button" value="提交" /></div><br/> </form> </div> <br/><div class="bottom">歡迎聯(lián)系我們<a href="http://ipnx.cn">php中文網(wǎng)</a></div> </div> </body> </html>
php程式碼主要邏輯如下:
- #修改頁(yè)面主要是接收管理頁(yè)面修改按鈕傳遞過來的id號(hào),透過id查詢資料庫(kù),取出目前這條文章的資料
- 在輸出區(qū)域?qū)①Y料裡面的每一項(xiàng)輸出出來