怎么用php做留言本,我的是php+mysql,高手们教教我呗

解决方案 »

  1.   

    php 100 里面有这个视频 用电驴就能找到很多
      

  2.   

    先去下载源代码调试看看,一些简单的基本用php一些常用函数和mysql语句完成.
      

  3.   

    这个不是很难吧。只要你不是完全的php盲人。
      

  4.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <link rel="shortcut icon" href="../image/favicon.ico" />
    <title>留言板</title>
    <style>
    .ul{
    float:left;
    list-style-type:none;
    }</style>
    <script>
    function check()

      document.getElementById("image").src="code.php?id="+Math.random();
    }
    function live( l )
    {

      
      if(l.txtTitle.value=="")
      {
         alert('请填写标题!');
     return false;

      }
      if(l.txtContent.value=="")
      {
         alert('请填写内容!');
     return false;
      }
       return true;
    }</script>
    </head><body style="font-family:'宋体'; font-size:12px; color:#000;">
    <?php 
    include_once('../conn/conn.php');
    $pageSize=3;
    $sql1="select count(*) from message where is_pass=1  ";
    $rs1=mysql_query( $sql1 );
    $count=mysql_result( $rs1,0,0);
    if( $count==0)
    die ('无留言记录');
    $pageCount=ceil( $count/$pageSize );  
    $currPage=intval( $_GET['page'] );
    if ($currPage<1)
    $currPage=1;
    if( $currPage>$pageCount)
    $currPage=$pageCount;
     $sql="select M_id,  M_title, M_date, M_content, M_reply from message   where is_pass=1 limit ". ($currPage-1)*$pageSize .", $pageSize";$rs=mysql_query($sql);?>
    <form action="" method="post" name="g_list" id="g_list" ><table width="600" height="165" border="1" cellpadding="0" cellspacing="0">
      <tr>
      <?php
      while( $row=mysql_fetch_array($rs) )
      {
    ?>
     
        <td align="left" valign="middle" bgcolor="#CCFFFF">标题:<?php echo $row['M_title']; ?></td>
      </tr>
      <tr>
        <td align="left" valign="middle">用户名:
        
       
        日期:<?php echo $row['M_date']; ?></td>
      </tr>
      <tr>
        <td height="76" align="left" valign="middle">内容:<br/><?php echo $row['M_content']; ?></td>
      </tr>
      <tr>
        <td align="left" valign="middle">回复:<?php echo $row['M_reply']; ?></td>
      </tr>
       <?php
      }?>
      <tr>
       <td height="15"><?php 
    if ($currPage==1)
    {
    ?>
    <ul class="ul"><li>首页 上一页</li></ul>
    <?php 
    }
    else
    {
    ?>  
    <a href="?page=1"><ul class="ul"><li>首页</li></ul> </a>
        <a href="?page=<?php echo $currPage-1; ?>" > <ul><li>上一页 </li></ul></a>
    <?php 
    }
    ?>
    <?php
    if ($currPage==$pageCount)
    {
    ?>
    <ul class="ul"><li>下一页  尾页</li></ul>
    <?php 
    }
    else
    {
    ?>  
    <a style="" href="?page=<?php echo $currPage+1; ?>"><ul class="ul"><li> 下一页</li></ul></a>
        <a href="?page=<?php echo $pageCount; ?>" ><ul class="ul"><li> 尾页</li></ul></a>
    <?php 
    }
    ?><ul class="ul"><li>跳转<select name="selPage" onchange=" location='?page=' + this.value;"></li></ul><?php 
    for( $i=1; $i<=$pageCount; $i++)
    {
    if( $i==$currPage)
    echo "<option value=$i  selected >$i</option>";
    else
    echo "<option value=$i >$i</option>";
    }
    ?></select>
    <ul class="ul"><li>第<?php echo $currPage; ?>页/共<?php echo $pageCount; ?>页&nbsp;</li></ul></td>
      </tr>
    </table>
    </form>
    <br />
    <br />
    <br />
    <br />
    <br /><form id="frmBook" name="frmBook" method="post" action="insert.php" onsubmit="return live( this );">
      <p>标题:
        <input type="text" name="txtTitle" id="txtTitle" />
      </p>
      <p>内容:</p>
      <p>
        <textarea name="txtContent" cols="50" rows="5" id="txtContent"></textarea>
      </p>
      <p>验证码:
        <input name="txtcode" type="text" id="txtcode" size="9" />
        <img src="code.php?id=<?php echo rand();?>" width="76" height="32" id="image" />
        <a href="javascript:check()">看不清换一张</a></p>
      <p>
        <input type="submit" name="button" id="button" value="留言" />
      </p>
    </form>
    </body>
    </html>
      

  5.   

    upup  结贴结贴
      

  6.   

    竟然有人把代码贴上来了。。
      PHP100找下,有很多个人完工的练手的,可以参考下
      

  7.   

    给你说下思路:
    1建立数据库
     字段id,留言的人,留言内容,(日期时间)
    2程序分两块
     1>提交表单;
     2>读取数据库把内容返回,你可以在这里加上分页。
    基本上就完成了。一张表,不用验证码,用户名的留言板就出来了。
    顺带提两句,你可以看看PHP100的视频教程,
    开发工具你可以到网上下个APMServ。
      

  8.   

    先建一个数据库啊,建一个留言表
    建表如#11然后用EasyEcl建一个项目,
    然后……然后就木有然后了,直接去PHP100去看视频吧
      

  9.   

    去php100视频教程11讲就有制作留言板了
      

  10.   

    去php100视频教程11讲就有制作留言板了