0

I have a multiple drop down list and I want to store the data into SQL Server Database when the user selects a particular option. The list is store in a JSON file and it is being displayed in the options in the drop down.

So if a person selects one drop down list the other list automatically displays a list based on the first one and so on. Upon clicking on submit button how can I store the selected values into a database.

Attaching a sample code for reference.

<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"
 }]
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
VJM
  • 1
  • 1
  • Please post your code. On the face of it, your question seems rather broad. – Robert Moskal Jan 17 '18 at 03:44
  • Welcome to SO. There are several material on the web on this specific task. Please read SO guidelines. – nazim Jan 17 '18 at 03:45
  • Have a look at this in the meantime - https://stackoverflow.com/questions/18351921/how-to-populate-a-cascading-dropdown-with-jquery – nazim Jan 17 '18 at 03:46
  • @RobertMoskal Is the code readable? Do let me know since this is my first post. Thanks – VJM Jan 17 '18 at 05:53

0 Answers0