mysql and forms

admin

Administrator
Staff member
The code below keeps giving me an error message on line 27. I'm new to php but was able to put this mysql input form together I need help im stuck.




<?php
//This portion checks to see if all of the fields have been filled in

if((!$sale_id) || (!$sale_name) || (!$sale_address) || (!$sale_month)
|| (!$sale_date) || (!$sale_stime) || (!$sale_ftime)) {
header("http://www.mysite.com/garageform/garageform1.htm");
exit;
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">

<HEAD>
<TITLE>Garage Sale Submission</TITLE>
</HEAD>
<BODY>
<h1>FCE thanks you for adding your Garage Sale<h1>
<?php
//This declares the sql command as a varible

$sql= "INSERT INTO GARAGE_SALES (SALE_ID, SALE_NAME, SALE_ADDRESS, SALE_MONTH
SALE_DATE, SALE_STIME, SALE_FTIME)
VALUES ('$sale_id','$sale_name','$sale_address','$sale_month',
'$sale_date','$sale_stime','$sale_ftime');

//connects to database
$connection = mysql_connect("localhost","user","password") or die ("Couldn't connect to server.");

$db = mysql_select_db("dbname",$connection); // or die ("Could'nt select database.");

//execute SQL query and get result
$sql_result = mysql_query($sql,$connection) or die ("Coul'nt execute query.");

if (!$sql_result) {
echo "<P>Could'nt add record!";
} else {

echo "
 
Back
Top