Greetings,
I have a php contact form where I can echo the form values to the screen
but the data won’t save to the database. I get the “empty query message”.
Here is my addcontact.php file :
thanks for any suggestions
<?php
// testing functions
echo 'filename : '.basename($_SERVER['SCRIPT_NAME']);
// New line
echo "<br><br>";
echo 'path : '.$_SERVER['SCRIPT_NAME'];
echo "<br><br>";
echo "<br><br>";
echo 'THANK YOU '.$firstname;
echo "<br><br>";
echo 'A new contact will be added to our database with the following information :';
echo "<br><br>";
echo 'Company : '.$company;
echo "<br><br>";
echo 'Last name : '.$lastname;
echo "<br><br>";
echo 'First name: '.$firstname;
echo "<br><br>";
echo 'Middle name: '.$middlename;
echo "<br><br>";
echo 'Email: '.$email;
echo "<br><br>";
echo 'Comments: '.$notes;
include ("db_connect.php");
mysql_query("INSERT INTO dealers (company, lastname, firstname, middlename, email, notes) VALUES ($company,$lastname,$firstname, $middlename, $email, $notes)");
if (!mysql_query($sql,$conn))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($conn);
?>