1 | initial version |
Assuming you are using a programming language to interact with the database, you can use a loop to insert multiple rows into the database based on the quantity provided in the input form. Here is an example code using PHP and MySQL:
// Retrieve the quantity from the input form
$quantity = $_POST['quantity'];
// Connect to the database
$con = mysqli_connect("localhost", "username", "password", "database_name");
// Loop through the quantity to insert multiple rows
for ($i = 0; $i < $quantity; $i++) {
$query = "INSERT INTO table_name (column1, column2, column3) VALUES ('value1', 'value2', 'value3')";
mysqli_query($con, $query);
}
// Close the database connection
mysqli_close($con);
In this example, $_POST['quantity']
is used to retrieve the quantity from the input form. Then, a loop is used to insert multiple rows based on the quantity provided. mysql_query()
is used to execute the SQL insert statement. Finally, the database connection is closed using mysqli_close()
.