Hi all!
I have a database set up and have a form to collect data. The database works, and the HTML form works. Bu tthe php code doesnt...
Here it is...
PHP Code:
<?php
$con = mysql_connect("localhost","testdatabase","******");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("web165-josh", $con);
$sql="INSERT INTO `qtsdispatches` (`item`, `itemValue`, `shipTo`, `building`, `street`, `townCity`, `postCode`, `refNum`, `collectionDate`, `location`, `courierName`, `consignmentNum`)
VALUES
('$_POST[item]','$_POST[item_value]','$_POST[ship_to]','$_POST[building]','$_POST[street]','$_POST[town_city]','$_POST[post_code]','$_POST[ref_num]','$_POST[collection_date]','$_POST[location]','$_POST[courier_name]','$_POST[consignment_num]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "<h1><b>Database has been updated with one record.</h1></b>";
mysql_close($con)
?>
*** The password, database name, table name ect is all correct. Infact the script runs to the end and displays the message "Database has been updated with one record".
When I look at my database I can see that a new row has been added to it, but EVERY SINGLE field is EMPTY. None of the data from the form was passed onto the database. Why would this be?
So the scripts runs fine, the database has been communicated with in some way because it adds a new row of data (but an empty one!).
I have been scratching my head for days and would very much appreciate it if someone could help me

.
Thanks in advance!!

.