【发布时间】:2018-05-07 05:52:16
【问题描述】:
我有两张桌子。我已通过带有 action="insert.php" 的 html 表单将数据插入data_types。
但问题在于我如何通过一个带有 action="insert1.php" 的 html 表单将数据插入data_table。
请教我如何填写第二张表格。任何建议将不胜感激。
data_types
id title
------ --------
1 d1
2 d2
3 d3
4 d4
5 d5
6 c1
7 c2
8 c3
9 c4
10 c5
11 c6
data_table
id name type_id type_value
------ ------ ------- ------------
1 Tapan 1 2
2 Tapan 2 0
3 Tapan 3 3
4 Tapan 4 8
5 Tapan 5 0
6 Tapan 6 12
7 Tapan 7 14
8 Tapan 8 0
9 Tapan 9 0
10 Tapan 10 17
11 Tapan 11 0
【问题讨论】:
-
在此处添加 insert.php 的代码。要将数据插入到另一个表中,请在 insert1.php 中输入您的 SQL 查询。
-
创建表单,插入数据。听起来您已经为另一张桌子做过一次。很难理解你的问题是什么?你到底在担心什么?
-
@ADyson 我将如何构造第二张桌子的
html form和sql query? -
是否必须同时在 data_type 中输入新行作为 data_table 中的新行?或者您只需要引用 type_id 并允许用户选择有效值?
-
@ADyson 我需要引用 type_id 并允许用户选择一个有效值。我想在一个 html 表单中插入所有引用 type_id 的值。你可以建议我关于表单结构。