After fixing the last problem with my script I decided to add in the part that submits to a database. I am getting a parse error on line 42. The part that is near line 42 is where the MySQL syntax "INSERT INTO" starts. It certainly has to be another simple thing that got overlooked but maybe you guys and ladies will be able to figure this out.
Thanks for having a look.
<?php
//DECLARE VARIABLES
$seller=$_POST['forsaleby'];
$first=$_POST['first'];
$last=$_POST['last'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$counties=$_POST['county'];
$city=$_POST['city'];
$lotsize=$_POST['lotsize'];
$squarefeet=$_POST['squarefeet'];
$bedrooms=$_POST['bedrooms'];
$baths=$_POST['baths'];
$utilities=$_POST['utilities'];
$citytaxes=$_POST['citytaxes'];
$price=$_POST['price'];
$comments=$_POST['comments'];
$termsofagree=$_POST['termsofagree'];
$submitform=$_POST['submitform'];
$to="[email protected]";
$message="$first $last has submitted a home to Triad Friendly Homes.\n Their email address is $email. \n Their phone number is $phone.\n They are selling as a $seller.";
//MAIL TO WEBMASTER
if ($_POST['email']) {
mail($to, "Home submit form.", $message, "From: $email");
echo "Thanks for submitting your home.";
}
else {
echo "Please fill in your email address.";
}
//LOG INFORMATION TO DATABASE
$DBhost="localhost";
$DBuser="******";
$DBpass="****";
$DBname="homesubmit";
$table="sellersinfo";
mysql_connect($DBhost, $DBuser, $DBpass) or die ("Unable to connect to database. Please try again.");
mysql_select_db("$DBname") or die ("Unable to select database.");
//!!!TROUBLE MAY BE LOCATED IN HERE!!!
$sql= "INSERT INTO $table(forsaleby, first, last, email, phone, county, city, lotsize, squarefeet, bedrooms, baths, utilities, citytaxes, price, comments, termsofagree) VALUES ('".$_POST['forsaleby']."', '".$_POST['first']."', '".$_POST['last']."', '"$_POST['email']."', '".$_POST['phone']."', '".$_POST['county']."', '".$_POST['city']."', '".$_POST['lotsize']."', '".$_POST['squarefeet']."', '".$_POST['bedrooms']."', '".$_POST['baths']."', '".$_POST['utilities']."', '".$_POST['citytaxes']."', '".$_POST['price']."', '".$_POST['comments']."', '".$_POST['termsofagree']."')";
$results = mysql_query ($sql);
print $sql;
mysql_close();
//UPLOAD PHOTO
if(copy($_FILES['usersphoto']['tmp_name'], "/home/triad/www/www/images/".$_FILES ['usersphoto']['name'])){
print ("Your file was successfully uploaded.");
}
?>
I hate to spoil everyone's fun but I found the problem again(it's easy to spot problems in this forum). I left a period out here...
'".$POST['email]."'
What a great natural high when the problem is fixed! :rocker:
Thanks.
Thanks for having a look.
<?php
//DECLARE VARIABLES
$seller=$_POST['forsaleby'];
$first=$_POST['first'];
$last=$_POST['last'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$counties=$_POST['county'];
$city=$_POST['city'];
$lotsize=$_POST['lotsize'];
$squarefeet=$_POST['squarefeet'];
$bedrooms=$_POST['bedrooms'];
$baths=$_POST['baths'];
$utilities=$_POST['utilities'];
$citytaxes=$_POST['citytaxes'];
$price=$_POST['price'];
$comments=$_POST['comments'];
$termsofagree=$_POST['termsofagree'];
$submitform=$_POST['submitform'];
$to="[email protected]";
$message="$first $last has submitted a home to Triad Friendly Homes.\n Their email address is $email. \n Their phone number is $phone.\n They are selling as a $seller.";
//MAIL TO WEBMASTER
if ($_POST['email']) {
mail($to, "Home submit form.", $message, "From: $email");
echo "Thanks for submitting your home.";
}
else {
echo "Please fill in your email address.";
}
//LOG INFORMATION TO DATABASE
$DBhost="localhost";
$DBuser="******";
$DBpass="****";
$DBname="homesubmit";
$table="sellersinfo";
mysql_connect($DBhost, $DBuser, $DBpass) or die ("Unable to connect to database. Please try again.");
mysql_select_db("$DBname") or die ("Unable to select database.");
//!!!TROUBLE MAY BE LOCATED IN HERE!!!
$sql= "INSERT INTO $table(forsaleby, first, last, email, phone, county, city, lotsize, squarefeet, bedrooms, baths, utilities, citytaxes, price, comments, termsofagree) VALUES ('".$_POST['forsaleby']."', '".$_POST['first']."', '".$_POST['last']."', '"$_POST['email']."', '".$_POST['phone']."', '".$_POST['county']."', '".$_POST['city']."', '".$_POST['lotsize']."', '".$_POST['squarefeet']."', '".$_POST['bedrooms']."', '".$_POST['baths']."', '".$_POST['utilities']."', '".$_POST['citytaxes']."', '".$_POST['price']."', '".$_POST['comments']."', '".$_POST['termsofagree']."')";
$results = mysql_query ($sql);
print $sql;
mysql_close();
//UPLOAD PHOTO
if(copy($_FILES['usersphoto']['tmp_name'], "/home/triad/www/www/images/".$_FILES ['usersphoto']['name'])){
print ("Your file was successfully uploaded.");
}
?>
I hate to spoil everyone's fun but I found the problem again(it's easy to spot problems in this forum). I left a period out here...
'".$POST['email]."'
What a great natural high when the problem is fixed! :rocker:
Thanks.