Free Webmaster Resources .info
PHP Introduction and Tutorials Javascript  Introduction and Tutorials HTML  Introduction and Tutorials ASP  Introduction and Tutorials Free Internet Access Guide and Directory Webspace  Directory Webhosting  Directory Adult Webhosting  Directory PHP Hosting  Directory ASP Hosting  Directory
à Navigation
» Home
» Php Introduction
» Php Tutorials
» Submit Scripts
 
Subscribe for free!

Join our mailing list today and recieve free updates monthly with web hosting specials!
 
 

 

 

Free Webmaster Resources .info | Free PHP Tutorials


Mailing List in PHP

In this section we will create a form for the user to fill in and also we will create a script to log the results into our email database . So without any further ado lets create our form.

Here is the code .

<form action = "joinnewsletter.php" method = "post">
<table>
<tr><td>
Name : </td>
<td><input type = "text" name = "name">
</td></tr>
<tr><td>
Email :
</td>
<td><input type = "text" name = "email">
</td></tr>
<tr><td>
<input type = "submit" value = "join"></td>
<td><input type = "reset" value = "clear"></td></tr>
</table>
</form>

Which will produce our form . Now we will store the user submitted details into our database . Call this joinnewsletter.php and enterthe following code .

<?php
//make a connection
$connection = mysql_connect("localhost" , "iainhendry" , "iain06")
or die("cannot make connection");
//select our database email
$db = mysql_select_db("email" , $connection)
or die("cannot find database");
//insert the values of our form into our database
$sql_query = "INSERT INTO email VALUES (\"$name\",\"$email\")";
$results = mysql_query($sql_query);
//display a thank you message and a link
echo ("Thank you for subscribing to our newsletter<br>");
echo ("<a href = 'index.htm'>Back to index page</a>");
?>

Now enter some data in the form and press submit (preferrably valid data) . Now we will check our table using MySQL , at the command prompt enter this .

SELECT * FROM email;

Here was what was displayed when I entered a coupl of my ffa submission emails addresses.

As you can see the email addresses and name has been added.

<Top | Back


Recommended Webhosting Company
Find free web hosting
Looking for free web hosting? Review and compare FindStuff's comprehensive resources. Search now!

 

 
Related Websites
 


Free Email
Your source to free email.

Free Casino Downloads
Contains useful free casino downloads.

Free Software Downloads
A complete collection of free software downloads.

Free
Download free stuff from psike.com your free stuff resource.

Free Teen Online Dating
Meet other singles for free online dating.

Coolfreeweb.com
The Free category at coolfreeweb.com

My Directory Listing
A massive directory listing of websites

Website Collation Project
The website collation project contains a huge directory of websites.


 
Top Webhosts
 
 1. Find free web hosting
 2. Free Web Hosting
 3. Web Hosting
 4. Free Web Hosting
 5. Web And Hosting
 
-
- Give us feedback
 
Last updated
Oct 11, 2008
Free Webmaster Resources .info | A resource must for every web master
Untitled Document - Web Hosting
- PHP Hosting
- Free Internet Access