Heading Here
Please help me. When I get the value of price and stock whatever number value I input will turn into 0.00 while the stock turns empty.Btw I can get the other fields the code and the title values my only problem are the stock and pice.
In the sql of php myadmin i declared the title and code as varchar while price is decimal and stock is integer.
What do I need to do with the price and stock please help meeeeeee....thank you=)
$getcode= $_GET['code'];
$gettitle=$GET_['title'];
$getprice=$GET_['price'];
$getstock=$GET_['stock'];
echo"
<table>
<tr><td><input type=text name=code[]>Code</tr></td>
<tr><td><input type=text name=title[]>Title</tr></td>
<tr><td><input type=number name=price[]>Price</tr></td>
<tr><td><input type=number name=stock[]>Stock</tr></td>
<tr><td><input type=submit value=ADD name=adds ></tr></td>
</table>
";
}
if (isset ($_GET['adds'])){
mysql_connect("localhost", "root", "")or die("Unable to Connect". mysql_error());
mysql_select_db("dbonlinebookstore");
mysql_query("INSERT INTO books VALUES('$getcode[0]','$gettitle[0]','$getprice','$getstock')");
$booksres=mysql_query("SELECT * FROM books");
echo "Book has been added" ;
while($row = mysql_fetch_array($booksres))
{
echo"<table><tr>";
echo "<td>" . $row['Code'] . "</td>";
echo "<td>" . $row['Title'] . "</td>";
echo "<td>" . $row['Price'] . "</td>";
echo "<td>" . $row['Stock'] . "</td>";
echo "</tr>";
echo"</table>";
}
}