更新时间:2023-01-29 20:31:14
请确保您输入的名称唯一.但是您可以像这样命名每列(请参见此处例如)
Be sure you name your inputs uniquely. But you can name every column like this (see here for example):
<input type="text" name="column1[]" />
<input type="text" name="column2[]" />
<input type="text" name="column3[]" />
这样,您可以使用for循环通过PHP访问列.
That way you can access the columns via PHP using a for loop.
for($i = 0; $i < $n; $i++) // If you have $n rows
{
echo($_POST["column1"][$i]);
echo($_POST["column2"][$i]);
echo($_POST["column3"][$i]);
}
To insert multiple rows into your mySQL database use the following syntax (also: see here).
INSERT INTO
tbl_name (column1, column2, column3)
VALUES
(1,2,3),
(4,5,6),
(7,8,9);
现在您应该设置为建立SQL查询.
Now you should be set to build your SQL query.