I am trying to update my phpmyadmin database using the php and html code below: I have been successful in adding a first row of data, but once I try to use the form again I cannot add another row of data unless I delete the previous one I inserted into the database. In short, I can only have 1 row in my database at a time. Thanks for any help :)
<html>
<head>
</head>
<body>
<form action="inserto.php" method="post">
Customer ID: <input type="number" name="IDc">
<br/>
Stock ID: <input type="number" name="IDs">
<br/>
Date of Purchase: <input type="date" name="dob">
<br/>
Pay status: <input type="text" name="paystatus">
<br/>
Price Paid: <input type="text" name="price">
<br/>
Discount: <input type="text" name="discount">
<br/>
<input type="submit" value="Submit">
</form>
</body>
</html>
<?php
$con = mysqli_connect("localhost", "root", "", "jainam_ia");
if(!$con)
{
echo 'Not connected';
}
$IDc=$_POST['IDc'];
$IDs=$_POST['IDs'];
$dob=$_POST['dob'];
$paystatus=$_POST['paystatus'];
$price=$_POST['price'];
$discount=$_POST['discount'];
$sql = "INSERT INTO tbl_orders (IDc, IDs, Date_of_purchase, Pay_Status, Price_Paid, Discount) VALUES ('$IDc', '$IDs', '$dob', '$paystatus', '$price', '$discount')";
if(!mysqli_query($con,$sql))
{
echo 'Order not added';
}
else
{
echo 'Order added';
}
header("refresh:2; url=indexo.html");
?>