留言板可以说是所有php入门者都会练习的一个小不上的WEB应用程序了,下面我把我写的一个php留言板实例分享给各位同学,有需要了解的同学可进入参考参考.
1.在你的PHP的根目录下创建一个名为”msgboard”的文件夹.在”msgboard”下创建一个“msglist.php”文件,数据表结构大家可直接导入。
实例代码如下:
- CREATE TABLE `msgboard` (
- `id` int(10) NOT NULL AUTO_INCREMENT,
- `username` varchar(50) CHARACTER SET latin1 NOT NULL,
- `sex` tinyint(1) NOT NULL DEFAULT '1',
- `msg` text CHARACTER SET latin1 NOT NULL,
- PRIMARY KEY (`id`)
- ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
msglist.php 文件,包括了留言增加,删除,修改
实例代码如下:
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
- <title>我的留言板</title>
- </head>
- <body>
- <?php
- $username = isset($_REQUEST['username']) ? $_REQUEST['username'] : ''; //姓名
- $sex = isset($_REQUEST['sex']) ? intval($_REQUEST['sex']) : 1; //性别
- $msg = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : ''; //留言
- mysql_connect("127.0.0.1","root","lzy"); //链接
- mysql_select_db("test"); //选择数据库
- if(!emptyempty($username) && !emptyempty($msg))
- {
- mysql_query("INSERT INTO msgboard(username,sex,msg) VALUES('$username','$sex','$msg')");
- }
- else
- {
- echo "输入不正确<br/>";
- }
- $source = mysql_query("SELECT * FROM msgboard ORDER BY id DESC");
- $result = array();
- ?>
- <table border="1" width="1000">
- <tr align="center">
- <td width="10%">姓名</td>
- <td width="10%">性别</td>
- <td width="80%">留言内容</td>
- </tr>
- <tr>
- <?php
- while ($row = mysql_fetch_array($source))
- {
- echo '<td>' . $row['username'] . '</td>';
- echo '<td>' . ($row['sex'] == 1 ? '男' : '女') . '</td>';
- echo '<td>' . $row['msg'] . '</td>';
- }
- ?>
- </tr>
- </table><p/>
- <form action="msglist.php" method="POST">
- <table width="1000" align="left">
- <tr>
- <td width="100%">
- 姓名:<input type="text" name="username" value=""/>
- </td>
- </tr>
- <tr>
- <td width="100%">
- 性别:男<input type="radio" name="sex" value="1" checked="checked" />
- 女<input type="radio" name="sex" value="0" />
- </td>
- </tr>
- <tr>
- <td width="100%">
- 请留言:<br/><textarea name="msg" rows="5" cols="100"></textarea>
- </td>
- </tr>
- <tr>
- <td width="100%">
- <input type="submit" value="提 交" />
- </td>
- </tr>
- </table>
- </form>
- </body>
- </html>
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
波比源码 » 一个php留言板实例详解
波比源码 » 一个php留言板实例详解
purchase levofloxacin online buy levofloxacin 500mg generic
generic avodart buy flomax 0.2mg for sale zofran 8mg oral
spironolactone 25mg cheap valtrex pills buy diflucan online
order ampicillin 250mg generic order erythromycin pill buy erythromycin online
buy sildenafil 50mg pill order careprost online cheap order methocarbamol generic
order suhagra 100mg pills order estrace 2mg order estrace 2mg pill
lamotrigine 50mg brand buy prazosin 2mg sale retin without prescription
tadalafil 20mg brand buy tadalafil 20mg without prescription buy diclofenac 100mg generic
buy isotretinoin 20mg generic purchase amoxicillin without prescription cost zithromax 250mg
indomethacin 75mg generic order terbinafine 250mg generic order trimox 500mg generic
cheap deltasone brand prednisone purchase viagra pills
accutane 10mg cheap amoxil order cost of stromectol medication
modafinil price purchase diamox online cheap acetazolamide generic
buspar 5mg cost ditropan 5mg cost cheap ditropan 2.5mg
alendronate 35mg cheap order ibuprofen pills purchase pepcid online
buy tacrolimus pills generic prograf 5mg buy ursodiol generic
generic imdur 40mg buy azathioprine buy generic micardis
order zyban 150mg pills purchase strattera online seroquel cheap
molnupiravir 200 mg us cefdinir 300mg pills buy prevacid 15mg generic
zoloft 50mg without prescription sertraline 100mg cheap cost of viagra 100mg
buy avlosulfon generic avlosulfon 100 mg oral order perindopril 4mg sale
buy provera 10mg online cyproheptadine 4mg pills buy generic periactin 4 mg
oral luvox 50mg order luvox pill order glipizide 5mg generic
brand isotretinoin 40mg order isotretinoin 20mg without prescription prednisone 5mg tablet
order piracetam online cheap sildenafil 150mg for sale buy viagra 50mg pill
purchase cialis without prescription cialis for sale online buy sildenafil pill
order furosemide pills order plaquenil pills plaquenil oral
order tadalafil 20mg generic anafranil 50mg without prescription anafranil tablet
sporanox 100mg ca prometrium us order tinidazole for sale
buy olanzapine 10mg pill order olanzapine 10mg online diovan 80mg oral
buy clozapine generic order ipratropium 100mcg for sale order decadron 0,0,5 mg pill
purchase viagra for sale buy generic lisinopril 10mg buy lisinopril 5mg generic
purchase prilosec for sale playing poker online for money online blackjack live dealer
lopressor 50mg generic order atenolol 100mg levitra 20mg without prescription
buy nothing day essay online casino gambling casino free spin
paper writing websites i need help with my essay order generic viagra
order clomid 50mg for sale buy clomid 100mg online hard rock casino online
buy cialis 10mg for sale order sildenafil for sale order generic viagra 100mg
triamcinolone over the counter purchase claritin pill buy clarinex online cheap
order orlistat 120mg online cheap buy orlistat 120mg generic buy acyclovir 400mg pills
order cialis sale inderal price order generic plavix 75mg
allopurinol without prescription order crestor 20mg for sale order zetia
methotrexate 2.5mg sale order methotrexate 2.5mg pills buy reglan 10mg sale
order generic motilium sumycin 250mg us flexeril price
baclofen 10mg brand ketorolac oral purchase toradol generic
buy colchicine 0.5mg without prescription order colchicine 0.5mg online cheap online money poker
poker online for fun blackjack vegas free online games free online poker games
flomax order online tamsulosin 0.2mg ca purchase aldactone pills
order metronidazole 200mg pill order flagyl 200mg without prescription cheap trimethoprim
buy cialis 40mg pill tadalafil 10mg brand usa viagra overnight
oral sildenafil 50mg buy viagra 50mg for sale discount cialis
order cefuroxime online cefuroxime 500mg pill methocarbamol uk
online slot machines real money free online poker games cheap tadalafil
purchase trazodone suhagra 50mg us buy aurogra 50mg online