PHP implementation of simple message book function code example-php Tutorial

Source: Internet
Author: User
This article describes in detail the implementation code of the simple message book function of PHP, which has some reference value, interested friends can refer to this article to introduce the implementation code of PHP simple message book function in detail, which has some reference value. interested friends can refer

This example shares the code of the PHP message book function for your reference. The details are as follows:

Index. php

 $ PageCount) // if the number of pages entered exceeds the total number of pages, the last page is redirected by default to {$ currpage = $ pageCount;}?>   
          
    
   
 Script function test () {var sum; if (document. frm. title. value = '') {alert ('Enter the title'); return false;} else {sum = document. frm. title. value. length; if (sum <5 | sum> 20) {alert ('title length: 5-20 characters'); return false ;}} if (document. frm. username. value = '') {alert ('Enter your network name'); return false;} if (document. frm. content. value = '') {alert (" Please fill in the content "); return false;} return true;} script   

Messages

  • Message title
  • User Network name
  • Time

Message content:

    «";}}?> $ I";} Else {echo"
  • $ I
  • ";}}?> »";}}?>

Post message

Conn. php

 

Result. php

 ", Str_replace (" "," ", $ content); // Display 'space' and 'carriage return '$ week = 'week '. mb_substr ("May 25, 1234", date ("w"), 1, "UTF-8"); $ isok = mysql_query ("insert into guestlist (title, username, content, addtime) values ('$ title',' $ username', '$ content ','". date ("Y-m-d H: I: s "). "$ week ')"); if ($ isok) {echo "script alert ('submitted successfully'); location. href = 'index. php'; script ";} else {echo" script alert ('submission failed'); location. href = 'index. php '; s Success "" ;}?>

Css/index.css

Body {margin: 0; padding: 0;} ul, li {list-style: none; margin: 0; padding: 0;} a {text-decoration: none ;}. content {width: 800px; margin: 0 auto ;}. bt {width: 799px; height: 20px; text-align: center; background: # EB9316; margin: 0 0 5px 0 ;}. bt> li {float: left; width: 265px; height: 20px; text-align: center; line-height: 20px; font-size: 13px ;}. nr {float: left;/* lynr after not floating will be affected */width: 799px; height: 20px; text-align: center; background: # B9DEF0 ;}. nr> li {float: left; width: 265px; height: 20px; text-align: center; line-height: 20px; font-size: 13px ;}. lynr {float: left;/* layout will be messy if not floating */width: 800px; margin: 1px 0 1px 0 ;}. content p {width: 70px; height: 50px; float: left ;}. content span {display: block; width: 710px; float: left;} td {width: 80px; padding: 5px 0;/* border: 1px solid #79 ABFE; */} td input, textarea {border: 1px solid #79 ABFE;}/* tr {display: block; /* set tr to block element. after the block element is displayed, it is surrounded by not a rectangle }*/

Dist/css/bootstrap.min.css (download by yourself)

:

The above is the code example for PHP to implement the simple message book function. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.