I have this code. It is supposed to send me a mail and place it into the sql database. and i don't think it is doing eather. can you check to see what is wrong
<?php
include ('../inc/db.php');
$f_name=$_POST['f_name'];
$l_name=$_POST['l_name'];
$date=$_POST['date'];
$text = $_POST['text'];
$option = $_POST['option'];
/* Lets add some slashes in case the user entered
any escaped characters. */
$f_name = addslashes($f_name);
$l_name = addslashes($l_name);
$date = addslashes($date);
$text = addslashes($text);
/* Do some error checking on the form posted fields */
if((!$f_name) || (!$l_name)){
echo 'You did not submit the following required information! <br />';
if(!$f_name){
echo "The First Name is a required field. Please enter it below.<br />";
}
if(!$l_name){
echo "Last Name is a required field. Please enter it below.<br />";
}
include 'index.php'; // Show the form again!
exit();
/* End the error checking and if everything is ok, we'll add the the following to the database and send it off */
/* Time to add the line breaks to the notes */
nl2br($text);
// Enter mail into the Database and do special characters.
$text2 = htmlspecialchars($text);
$sql = mysql_query("INSERT INTO contact (f_name, l_name, date, text, option)
VALUES ('$f_name', '$l_name', '$date', '$text', '$option')") or die (mysql_error());
if(!$sql){
echo 'There has been an error sending the mail. Please contact the webmaster.';
} else {
echo 'Your mail was sent. ';
}
// Let's mail the user!
$subject = "You were e-mail from the site";
$message = "Dear $f_name $l_name,
You were sent an e-mail from the site.
$text
They thought the site was $option
Thanks!
This is an automated response, please do not reply!";
mail( "demosthenes705@gmail.com", $subject, $message, "From: Spring_Break <$adminemail>\nX-Mailer: PHP/" . phpversion());
{
echo 'Thanks for sending an e-mail the chris. he will respond soon.';
}
}
?>