Hi there,
I have written a page which is meant to allow a user to enter details of a new car for sale (via a form), and then the submission of this form should add the details to the database.
As far as I can see all the code is correct, yet I don't get a new entry.
The Form
------------
<form action="addCar.php" method="post">
Category: <select name="Category">
<option>Classic</option>
<option>Modern</option>
<option>Range_Rover</option>
</select>
<br />
Make:<input type="text" name="Make" value=""><br />
Model: <input type="text" name="Model" value=""><br />
Reg Year: <input type="text" name="Reg_Year" value=""><br />
Reg Letter: <input type="text" name="Reg_Letter" value=""><br />
Mileage: <input type="text" name="Mileage" value=""><br />
Price: <input type="text" name="Price" value=""><br />
Price Alternate: <input type="text" name="Price_Alternate" value=""><br />
Description: <textarea cols="60" name="Description" rows="4"></textarea><br />
Image 1: <input type="text" name="Image1" value="<? echo $Image1; ?>"><br />
Image 2: <input type="text" name="Image2" value="<? echo $Image2; ?>"><br />
Image 3: <input type="text" name="Image3" value="<? echo $Image3; ?>"><br />
Image 4: <input type="text" name="Image4" value="<? echo $Image4; ?>"><br />
<input type="Submit" value="Add" name="send">
</form>
addCar.php
--------------
<?php
$Category=$_POST['Category'];
$Make=$_POST['Make'];
$Model=$_POST['Model'];
$Reg_Year=$_POST['Reg_Year'];
$Reg_Letter=$_POST['Reg_Letter'];
$Mileage=$_POST['Mileage'];
$Price=$_POST['Price'];
$Price_Alternate=$_POST['Price_Alternate'];
$Description=$_POST['Description'];
$Image1=$_POST['Image1'];
$Image2=$_POST['Image2'];
$Image3=$_POST['Image3'];
$Image4=$_POST['Image4'];
$username="usrname";
$password="pwrd";
$database="dbName";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="INSERT INTO cars (Category, Make, Model, Reg_Year, Reg_Letter, Mileage, Price, Price_Alternate, Description, Image1, Image2, Image3, Image4) VALUES ('$Category,'$Make','$Model','$Reg_Year','$Reg_Letter,'$Mileage','$Price','$Price_Alternate','$Description','$Image1','$Image2','$Image3','$Image4')";
mysql_query($query);
echo "Car Added";
mysql_close();
?>
Is this a case of "can't see the wood for the tree's"? Am I missing something glaringly obvious?
Cheers guys,
Ed