Contacts

“Cheap Cialis inurl guestbook php. Guestbook in PHP Add your review here

In this tutorial we will create a guest book in PHP using AJAX. The records will be stored in a database. The table will contain the following information: sender's name, email address, IP address and date-time of the last recording. jQuery will be used (to implement AJAX). It will also be implemented simple protection against spam - you can post no more than one entry every 10 minutes.

Step 1: SQL

For our application to work, we need to create a table:

CREATE TABLE IF NOT EXISTS `s178_guestbook` (`id` int(10) unsigned NOT NULL auto_increment, `name` varchar(255) default "", `email` varchar(255) default "", `description` varchar(255) default "", `when` int(11) NOT NULL default "0", `ip` varchar(20) default NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Step 2: PHP

The main file will contain the following code:

guestbook.php

Guestbook Add your comment here function submitComment(e) ( var name = $("#name").val(); var email = $("#email").val(); var text = $("#text ").val(); if (name && email && text) ( $.post("guestbook.php", ( "name": name, "email": email, "text": text ), function(data) ( if (data != "1") ( $("#records_list").fadeOut(1000, function () ( $(this).html(data); $(this).fadeIn(1000); )); ) else ( $("#warning2").fadeIn(2000, function () ( $(this).fadeOut(2000); )); ) ) ) else ( $("#warning1").fadeIn(2000 , function () ( $(this).fadeOut(2000); ) );

Your name:
Your email:
Review:
Fill in all required fields You cannot post more than one review within 10 minutes (spam protection)
Did you like the article? Share it