I am trying to use this script to enter data into my database from an html form.

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

<html>
<head>
	
 <title>Item Entry - Opulentworx - Private</title>

</head>

<body>

<form action="/php/itemENTRY.php" method="post" id="itemENTERdb">
<input type="text" id="itemNUM"/>Item #<br>
<input type="text" id="quant"/>Quantity<br>
<input type="text" id="date"/>Date<br>
<input type="text" id="cost"/>Cost<br>
<input type="text" id="ground"/>UPS Ground<br>
<input type="text" id="3day"/>3 Day UPS<br>
<input type="text" id="2day"/>2 Day UPS<br>
<input type="text" id="nextDAY"/>Next Day UPS<br>
<input type="text" id="salesTAX"/>Sales Tax<br>
<input type="text" id="dFEE"/>Design Fee<br>
<input type="text" id="pFEE"/>Print Fee<br>
<input type="text" id="markUP"/>Mark-UP<br>
<input type="text" id="subTOT"/>Sub-Total<br>
<input type="text" id="flTAX"/>FL Tax<br>
<input type="submit" value="Save Date"/>
<input type="reset" value="Reset Date"/>
</form>



</body>
</html>
<?
$link = mysql_connect("mysql","user","XXXXXXXX");
if (!$link)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("prodINFO", $link);
$sql="INSERT INTO 'table1' ('itemNUM', 'quant', 'date', 'cost', 'ground', '3day', '2day', 'nextDAY', 'salesTAX', 'dFEE', 'pFEE', 'markUP', 'subTOT', 'flTAX') 
VALUES ('$_POST["itemNUM"]', '$_POST["quant"]', '$_POST["date"]', '$_POST["cost"]', '$_POST["ground"]', '$_POST["3day"]', '$_POST["2day"]', '$_POST["nextDAY"]', '$_POST["salesTAX"]', '$_POST["dFEE"]', '$_POST["pFEE"]', '$_POST["markUP"]', '$_POST["subTOT"]', '$_POST["flTAX"]')";
}

if (!mysql_query($sql,$link))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";

mysql_close($link);

?>

can anyone tell me why it won't work?

Member Avatar for iamthwee

When you won't work. Tell us exactly what you mean?!

Member Avatar for fatihpiristine

general mistake :

change $_post tags to $_request

you already posted the values... why you post them again on page itemENTRY.php

funny :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.