In this tutorial I want to explain how to implement a simple launching soon page using PHP and jQuery. What’s a launching soon page? In general it’s a page that informs the visitors of a website under construction about when the website is going to be online and allows them to leave their emails in order to be updated when the website is on-line. A typical launching soon page contains a countdown and a form that collects emails from interested visitors. In this tutorial I implemented a launching soon page like this:

Launching Soon!
This page is very simple to modify and customize using just some lines of CSS code. You can also add the logo of your company and all elements you want with some lines of HTML code. Download the source code of this tutorial you can customize and reuse in your web project for free!
A little introduction
How I said this package is ready to use and contains these files:

- index.php: the launching soon page final interface (countdow + form)
- config.php: enables database connection
- insert.php: PHP code to add emails into a database table
- js/jquery-1.3.2.min.js: jQuery framework
- js/countdown.js: the countdown script
1. index.php
index.php is the final interface of your launching soon page. How I said it contains a countdown and a form to allow users to leave their emails.
The countdown script
In order to implement the countdown I used this dynamic countdown script that lets you count down to relative events of a future date/time. This future date, while the same for everyone, occurs differently depending on the time zone they’re in. The result is here and it’s fully customizable changing some lines of CSS code:

The only thing you have to do is to add this line of code in the <head> tag of the page:
<script type=“text/javascript” src=“js/countdown.js”></script>
Then, in the tag <body> add the following lines of code to display the countdown:
In particular .count_down{} changes the format of the numbers and .count_down sup{} changes the style of the text “days”, “hours”, “minutes”.
jQuery and the input form
Ok, the countdown is ready! Next step: add this line of code to include jQuery in the <head> tag of the page:
Now, in the tag <body> add a simple form with an input field:
…and add this layer to display a custom message when an user submit the form:
…the result after the submission is here:

The form with the input field disappears with a nice fade-out effect and a success message appears in its place. Now, in the <head> tag, after the line of code that includes jQuery, add this script to enable ajax functionalities to insert emails added from users into a database table without reload the page:
</script>
2. insert.php
insert.php contains some lines of PHP code to insert an email address into a database table. In this example I created a table EMAIL with just one attribute “email”. PHP code is very simple:
$sql = ‘INSERT INTO WALL (email) VALUES( “‘.$email.‘”)’;
mysql_query($sql);
echo $email;
} else { echo ‘0′; }
?>
Now, remember to modify your database connection parameters in config.php and upload all files on your testing server. Than load index.php and see the result!
That’s all! Download the source code of this tutorial you can customize and reuse in your web project for free! Leave a comment for your suggestions, thanks!
good job stripping html to prevent _sql_ query injection