我有一个多下拉列表,我想在用户选择特定选项时将数据存储到SQL Server数据库中。该列表存储在JSON文件中,并显示在下拉列表中的选项中。
因此,如果一个人选择一个下拉列表,则另一个列表会自动显示基于第一个列表的列表,依此类推。单击“提交”按钮后,如何将所选值存储到数据库中。
附上示例代码以供参考。
<table class="table">
<thead>
<th>
Interaction Reason 1
</th>
<th>
Interaction Reason 2
</th>
<th>
Interaction Reason 3
</th>
</thead>
<tbody>
<tr>
<td>
<select name="IR1" id="IR1" class="form-control input-sm">
<option value=""></option>
</select>
</td>
<td>
<select name="IR2" id="IR2" class="form-control input-sm">
<option value="">--Select Option--</option>
</select>
</td>
<td>
<select name="IR3" id="IR3" class="form-control input-sm">
<option value="">--Select Option--</option>
</select>
</td>
</tr>
</tbody>
</table>
<button type="button" name="sub" class="btn btn-default">submit</button>
[
{
"id":"1",
"name":"Request",
"parent_id":"0"
},
{
"id":"2",
"name":"Cancel",
"parent_id":"0"
},
{
"id":"3",
"name":"Refund",
"parent_id":"0"
},
{
"id":"4",
"name":"Address Change",
"parent_id":"1"
},
{
"id":"5",
"name":"Color Change",
"parent_id":"1"
},
{
"id":"6",
"name":"Customer wants to change product color",
"parent_id":"5"
},
{
"id":"7",
"name":"Cancel Order",
"parent_id":"2"
},
{
"id":"8",
"name":"Customer wants a new Product",
"parent_id":"7"
}]