Okay here is what I am trying to do. I want to have my members be able to refer their friends to our mailing database. Anyway I got the stuff set up and almost working, can you tell me what I did wrong?
Thanks ahead of time!!
<body bgcolor="#D6CAD8" color="#D6CAD8">
<?php
$server = "localhost";
$user = "username";
$password = "password";
$database = "db";
mysql_connect($server, $user, $password) or die(mysql_error());
mysql_select_db($database) or die(mysql_error());
if (empty($_POST['name'])) {
echo "You didn't enter your name.<br />";
$error = 1;
}
if (empty($_POST['email'])) {
echo "You didnt enter a email address.<br />";
$error = 1;
}
if (empty($_POST['refer'])) {
echo "You didn't enter your refferrer.<br />";
$error = 1;
}
if (!$error) {
$query = "INSERT INTO emailads VALUES('{$_POST['id']}', '{$_POST['name']}', '{$_POST['email']}', '{$_POST['refer']}',)";
$result = mysql_query($query);
if (!$result) { //error w/ db
echo "Sorry, your info couldn't be entered right now, please try again later.";
} else {
echo " <html> <div align=\"center\">
<center>
<table border=\"4\" width=\"67%\" cellspacing=\"4\" bgcolor=\"#D8C7E0\" bordercolor=\"#49354F\">
<tr>
<td width=\"100%\">
<blockquote>
<p align=\"center\"><font face=\"Tahoma\" color=\"#49354F\"><font size=\"5\">Thank you for submitting, the below information has been sent to the Database!</font> <br> <br> <br> </font></p>
<div align=\"center\">
<table border=\"0\" width=\"218\">
<tr>
<td width=\"210\">
<p align=\"left\"><font face=\"Tahoma\" color=\"#49354F\"><font size=\"4\">Name:</font>
{$_POST['name']}</font></p>
<p align=\"left\"><font face=\"Tahoma\" color=\"#49354F\"><font size=\"4\">Email Address:</font>
{$_POST['email']}</font></p>
<p align=\"left\"><font face=\"Tahoma\" color=\"#49354F\"><font size=\"4\">Refferrer:</font>
{$_POST['refer']}</font></p>
<p align=\"left\"><font face=\"Tahoma\" color=\"#49354F\"><font size=\"4\">ID:</font>
{$_POST['id']}</font></p>
</td>
</tr>
</table>
</div>
<p> </p>
</blockquote>
</td>
</tr>
</table>
</center>
</div></html>";
}
}
?>
Okay there is the part that connects to the database....