ok this is what I've got so far... It's giving me an error in the code ... now I'm stuck!! Any suggestions???
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .="From: ".$_POST["yourname"]." <".$_POST["youremail"].">\r\n";
if(!mail($_POST["email"],"email subject","email message", $headers)) { echo ""; exit; }
else { echo "Well done, thanks!"; }
if (isset($_POST['submit'] )) {
include('connect-mysql.php' ) ;
$email = $_POST['email'] ;
$yourname = $_POST['yourname'] ;
$youremail = $_POST['youremail'] ;
$sqlinsert = "INSERT INTO friends (email, yourname, youremail) VALUES ( '$email' , '$yourname' , '$youremail' )" ;
if(!$email == "" && (!strstr($email,"@") || !strstr($email,".")))
{
echo "<p>Please Go Back and enter a valid e-mail address</p>\n";
$badinput = "<p>we need your valid email </p>\n";
echo $badinput;
die ("Use new form ! ");
}
if(empty($email) || (empty($yourname) ||empty($youremail)))
{
echo "<p>You have not completed all fields, please Go Back and fill out all the fields</p>\n";
die ("Use anew form ! ");
}
mysql_query($sqlinsert = "INSERT INTO friends (email, yourname, youremail) VALUES ( '$email' , '$yourname' , '$youremail' )");
?>