PHP開發(fā) 小型論壇教程之帖子回復-1
創(chuàng)建 reply.php 文件
我們的回復頁面也是采用了<table>表格+css樣式進行頁面布局
最終的頁面效果如下圖
代碼如下
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>回復</title> <style> .title{ background-color: #B10707; color: white; } .sub{ text-align: center; } .but{ background-color: #B10707; width: 90px; height: 40px; font-size: 15px; color: white; border: none; } input{ width: 250px; height: 25px; } .right{ margin-left: 10px; } </style> <script type="text/javascript"> function checkinput() { if(myform.reply_author.value=="") { alert("請輸入你的昵稱"); myform.reply_author.focus(); return false; } if (myform.reply.value=="") { alert("請輸入你想回復的內(nèi)容"); myform.reply.focus(); return false; } } </script> </head> <body> <form method="post" action="reply_post.php?id=<?php echo $_GET['id']; ?>" onsubmit=" return checkinput();" name="myform"> <table width="500px" border="1" cellpadding="8" cellspacing="0" align="center"> <tr class="title"> <td colspan="2"> 回復帖子<span class="right">[<a style="color: white" href="forums.php">返回</a> ]</span> </td> </tr> <tr> <td width="100px">回復人</td> <td><input type="text" name="reply_author"></td> </tr> <tr> <tr> <td width="100px">回復內(nèi)容</td> <td><textarea cols="43" rows="10" name="reply"> </textarea></td> </tr> <tr class="sub"> <td colspan="2"> <input type="submit" value="快速回復" class="but"> <input type="reset" value="重置" class="but"> </td> </tr> </table> </form> </body> </html>
下一步將我們回復的內(nèi)容提交到reply_post.php頁面進行數(shù)據(jù)處理