Chinaunix首页 | 论坛 | 博客
  • 博客访问: 382778
  • 博文数量: 104
  • 博客积分: 652
  • 博客等级: 上士
  • 技术积分: 1477
  • 用 户 组: 普通用户
  • 注册时间: 2012-07-04 15:20
文章分类

全部博文(104)

文章存档

2019年(1)

2015年(8)

2014年(6)

2013年(59)

2012年(30)

分类: 系统运维

2012-11-28 10:35:59

最初的最初,简单功能,留言插入查询

先上丑图

CSS

点击(此处)折叠或打开

  1. body {
  2.     margin:0 auto;
  3.     width:980px;
  4.     padding:0;
  5.     font:12px Arial,宋体;
  6.     text-align:center;
  7. }


  8. .guessbook {
  9.     margin-top:20px;
  10.     width:980px;
  11.     height:300px;
  12.     background:red;
  13. }

  14. .guessbook .name {
  15.     margin:0px auto;
  16.     width:280px;
  17.     height:100px;
  18.     background:blue;
  19.     float:left;
  20. }

  21. .guessbook .name h2 {
  22.     font-family: "微软雅黑", Times, serif;
  23.     font-size: 24px;
  24.     line-height:60px;
  25.     color: #9F9;
  26. }
  27. .guessbook .text {
  28.     margin:0px auto;
  29.     width:700px;
  30.     height:200px;
  31.     background:#669;
  32.     float:left;
  33.     clear:left;
  34. }

  35. .guessbook .text textarea{
  36.     margin-top:20px;
  37.     overflow:hidden;
  38. }

  39. .guessbook .sub {
  40.     margin:0px auto;
  41.     width:250px;
  42.     height:100px;
  43.     background:#09F;
  44.     float:right;
  45.     margin-top:100px;
  46. }

  47. .guessbook .sub input{
  48.     margin:10%;
  49.     height:50px;
  50.     width:100px;
  51.     overflow:hidden;
  52. }

  53. .show {
  54.     margin:0px auto;
  55.     padding-top:20px;
  56.     padding-bottom:20px;
  57.     width:980px;
  58.     background:#3C6;
  59. }
  60. .show .smsbox {
  61.     margin:0 auto;
  62.     width:900px;
  63.     height:200px;
  64.     background:#FC0;
  65. }

  66. .show .smsbox p{
  67.     font-family:"微软雅黑";
  68.     font-size:16px;
  69.     text-align:left;
  70.     text-indent:2em;
  71.     padding:20px;
  72. }


  73. .show .tiao {
  74.     margin:5px auto;
  75.     overflow:hidden;
  76.     width:880px;
  77.     height:1px;
  78.     background:#93C;
  79. }

PHP

点击(此处)折叠或打开

  1. <?php
  2.     $conn=mysql_connect("localhost","root","123456");
  3.     mysql_select_db("test",$conn);
  4.     mysql_query('set names utf8');
  5.     $inst="INSERT INTO liuyan (`data`) VALUES ('".$_POST['text']."')";
  6.     mysql_query($inst);
  7. ?>
  8. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
  9. <html>
  10.     <head>
  11.         <title>留言板</title>
  12.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  13.         <link rel="stylesheet" type="text/css" href="css/style.css" />
  14.     </head>
  15.     <body>
  16.     <div class="guessbook">
  17.         <div class="name">
  18.             <h2>说点什么吧...</h2>
  19.         </div>
  20.             <form action="#" method="post" name="ly">
  21.               <div class="text">
  22.                 <textarea name="text" rows="9" cols="80"></textarea>
  23.               </div>
  24.               <div class="sub">
  25.             <input type="submit" value="GO!" />
  26.               </div>
  27.             </form>
  28.     </div>
  29.     <div class="show">
  30.         <?php
  31.             $sql="SELECT data FROM liuyan";
  32.             $result=mysql_query($sql);
  33.             while($tmp = mysql_fetch_array($result)){
  34.                 echo "
    ";
  35.                 echo "

    ";

  36.                 echo $tmp['data'];
  37.                 echo "

    "
    ;
  38.                 echo "
";
  •                 echo "
    "
    ;
  •             }
  •         ?>
  •     </div>
  •     </body>
  • </html>

  • 阅读(784) | 评论(0) | 转发(0) |
    给主人留下些什么吧!~~