<?php
if(!isset($_REQUEST['validate']))
{
die("You must not access this page directly!"); //Just to stop people from visiting .php normally
}
$name = $_REQUEST['fullname'] ;
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
$name = $_REQUEST['fullname'] ;
//Here: Connection to DB.
$connmysql = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$connmysql) {
die('Could not connect: ' . mysql_error());
}
//Here: add 2 DB string
$gomysql = "Insert Into table_name(table_row_name_for_name,table_row_name_for_subject,table_row_name_for_message,table_row_name_for_email) Values('" .$name."', '" .$subject."', '" .$message."', '" .$email."')";
$msg = "from: $name
$message"
if(mail(name@host.com, $subject, $msg, $email))
{
echo "/*PLACE HTML IF SEND IS SUCCESSFUL*/";
//Here: Adding stuff to DB
mysql_query ($gomysql);
}
else
{
echo "/*PLACE HTML IF SEND IS UNSUCCESSFUL*/";
}
//Here: Closing Connection to DB
mysql_close($connmysql);
?>