title: How to Save Form with the Dynamic Table having MultiSelect Dropdown in each row in Laravel
body: <p><a href="https://i.stack.imgur.com/Epbwh.png" rel="nofollow noreferrer">Multiselect Drop Down of Color and Size in Dynamic Table with name attribute</a></p>
  <p>In My Form I have Dynamic Table, Having Multi Select Dropdowns with same names color_id[] and size_id[] in each row. I am Not Getting How to save the multi selected values as comma separated values in each row in database. Here I have tried to save in database, but not working.
  HTML CODE:</p>
  <pre><code>   &lt;table&gt;&lt;tbody&gt;&lt;td&gt;&lt;select name=&quot;color_id[]&quot; class=&quot;select2&quot; id=&quot;color_id&quot; style=&quot;width:200px; height:100px;&quot; required multiple&gt;&lt;/select&gt;&lt;/td&gt;&lt;td&gt; &lt;select name=&quot;size_id[]&quot; class=&quot;select2&quot; id=&quot;size_id&quot; style=&quot;width:200px; height:100px;&quot; required multiple&gt; &lt;/select&gt;&lt;/td&gt;&lt;/tbody&gt;&lt;/table&gt;
  </code></pre>
  <p>Laravel Save Code in Controller:</p>
  <pre><code> $class_ids = $request-&gt;input('class_ids');
   for($x=0; $x&lt;count($class_ids); $x++) {
      # code...
      $color_ids = implode(',', $request-&gt;color_id[$x]);
      $size_ids = implode(',', $request-&gt;size_id[$x]);
       $data3[]=array(
              
          'bom_code'=&gt;$TrNo, 
          'bom_date'=&gt;$request-&gt;bom_date, 
          'cost_type_id'=&gt;$request-&gt;cost_type_id,
          'Ac_code'=&gt;$request-&gt;Ac_code, 
          'season_id'=&gt;$request-&gt;season_id,
          'currency_id'=&gt;$request-&gt;currency_id, 
          'item_code' =&gt; $request-&gt;item_codes[$x],
          'class_id' =&gt; $request-&gt;class_ids[$x],
          'description' =&gt; $request-&gt;descriptions[$x],
          'color_id' =&gt; $color_ids,
          'size_array' =&gt; $size_ids,
          'consumption' =&gt; $request-&gt;consumptions[$x],
          'unit_id'=&gt; $request-&gt;unit_ids[$x],
          'rate_per_unit' =&gt; $request-&gt;rate_per_units[$x],
          'wastage' =&gt; $request-&gt;wastages[$x],
          'bom_qty' =&gt; $request-&gt;bom_qtys[$x],
          'total_amount' =&gt; $request-&gt;total_amounts[$x],
         
           );
          }
        BOMSewingTrimsDetailModel::insert($data3);
  </code></pre>