Hello:
I'm running a small test query and I'm trying to populate a table. The table has three fields: item_code, price, qty.
When I run my script, price and qty are populated and item_code is not.
Can someone take a look and help me debug this problem?
This is the form which calls the PHP script:
<form method="post" action="test.php">
<input type="hidden" name="item_code" value="VEB120">
<input type="hidden" name="price" value="76.00">
<input type="text" name="qty" size="15">
<input type="submit" name="submit" value="Add to Cart">
</form>
This is the PHP script:
<?php
//connect to database
$conn = mysql_connect('localhost', 'xx', 'xx') or die(mysql_error());
$db = mysql_select_db("xx")
or die(mysql_error());
//add to product table
$add_product = "insert into test1 values ('$_POST[item_code]', '$_POST[price]',
'$_POST[qty]')";
mysql_query($add_product) or die(mysql_error());
?>
Also, this is my table structure:
item_code VARCHAR(25)
price INT
qty INT
Thank you for all your help.