Home  >  Article  >  Backend Development  >  PHP留言板(范例)

PHP留言板(范例)

WBOY
WBOYOriginal
2016-06-13 12:36:271037browse

PHP留言板(实例)

lyb.htm




 

    姓名:
   
     *
    

    我是:
     校长
     主任
     教师
     家长
     学生
    

    QQ:
     不公开,建议填写以便及时回复通知到你
    

    E-mail:
     *
    

    手机号码:
     *
    

    我要留言:
    
    

   

    
    
   

   

    

    



lyb.php

    @$name=$_POST["name"];
    @$lb=$_POST["lb"];
    @$qq=$_POST["qq"];
    @$email=$_POST["email"];
    @$phone=$_POST["phone"];
    @$content=$_POST["content"];
    $conn=mysql_connect("localhost","root","123");
    if($content!="")
    {
        $conn=mysql_connect("localhost","root","123");
        mysql_select_db("lyb");
    //    mysql_query("set names gbk");
        $sql="insert into ly(name,lb,qq,email,phone,content) values('{$name}','{$lb}','{$qq}','{$email}','{$phone}','{$content}')";
        //var_dump($sql);
        //die();
        $rs=mysql_query($sql);
        $row=mysql_affected_rows($conn);
        if ($row>0)
        {
            echo "";
        }
        else
        {
            echo "";
        }
    }
?> 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn