Here is the entire code for do_quote.php (the page which generates a quote, displays the data and writes everything to the MYSQL database)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Quote generator</title>
<link rel="stylesheet" type="text/css" href="view.css" media="all">
<script type="text/javascript" src="view.js"></script>
</head>
<body id="main_body" >
<img id="top" src="top.png" alt="">
<div id="form_container">
<h1><a>Quote generator</a></h1>
<form id="form_34416" class="appnitro" method="post" action="quote.php">
<div class="form_description">
<h2>Quote generator</h2>
<p>Use this form to generate a quote. There is no obligation to buy.</p>
</div>
<h4>Cust_Name</h4>
<?php echo htmlspecialchars($_POST['element_1']); ?>.
<h4>Email</h4>
<?php echo htmlspecialchars($_POST['element_2']); ?>
<h4>Address</h4>
<?php echo htmlspecialchars($_POST['element_3']); ?>
<h4>Postcode</h4>
<?php echo htmlspecialchars($_POST['element_4']); ?>
<h4>Approx area of paving in m²</h4>
<?php echo (int)$_POST['element_5']; ?>
<h4>County</h4>
<?php echo $_POST['element_6']; ?>
<h4>Job Type</h4>
<?php echo $_POST['element_7']; ?>
<br>
<br>
<h3><b>Your Quote</b></h3>
<br>
<?php
$area = (int)$_POST['element_5'] ;
$job_type = $_POST['element_7'] ;
if ($job_type == "Asphalt") {
$cost_per_m2 = 1 ;
}
if ($job_type == "Block Paving") {
$cost_per_m2 = 1 ;
}
if ($job_type == "Tarmacadam") {
$cost_per_m2 = 1;
}
if ($job_type == "Concrete") {
$cost_per_m2 = 1;
}
if ($job_type == "Imprinted Concrete") {
$cost_per_m2 = 1;
}
if ($job_type == "Garden Paving") {
$cost_per_m2 = 1;
}
if ($job_type == "Not Sure") {
$cost_per_m2 = 0;
}
$quote = ($area * $cost_per_m2) ;
echo "Approximate cost of this job will be £" ;
echo $quote ;
$my_t=getdate(date("U"));
$date = ("$my_t[month] $my_t[mday], $my_t[year]");
$Cust_Name = htmlspecialchars($_POST['element_1']);
$Address = htmlspecialchars($_POST['element_3']);
$Postcode = htmlspecialchars($_POST['element_4']);
$Approx_area_m2 = (int)$_POST['element_5'];
$County = $_POST['element_6'];
$Email = $_POST['element_2'];
$Job_Type = $_POST['element_7'];
mysql_connect ("mysql4.000webhost.com", "a8085020_admin", "27679262a") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("a8085020_new");
mysql_query ("INSERT INTO leads
(Lead_Date, Cust_Name, Address, Postcode, County, Email, Job_Type, Approx_area_m2, Quote_Generated) VALUES($date, $Cust_Name, $Address,
$Postcode, $County, $Email, $Job_Type, $Approx_area_m2, $quote) ")
or die(mysql_error());
?>
</form>
<div id="footer"></div>
</div>
<img id="bottom" src="bottom.png" alt="">
</body>
</html>
And this is the error I get after entering some random data into the first page:
Approximate cost of this job will be £48You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '23, 2009, Homer Simpson, 172 Evergreen Terrace, Springfield, BB5 5HG, Isle of ' at line 2