Note that there are some explanatory texts on larger screens.

plurals
  1. POphp insert multiple rows in my sql database for every checked checkbox
    primarykey
    data
    text
    <p>Say i have the following form:</p> <pre><code>&lt;form action="" method="post"&gt; &lt;/BR&gt; &lt;?php // create two dropdowns with ajax echo "&lt;font id=\"categoria\"&gt;&lt;select&gt;\n"; echo "&lt;option value='0'&gt;Select the Firm&lt;/option&gt; \n" ; echo "&lt;/select&gt;&lt;/font&gt;\n"; ?&gt; &lt;?php echo "&lt;font id=\"subcategoria\"&gt;&lt;select&gt;\n"; echo "&lt;option value='0'&gt;Select the Claims Hub&lt;/option&gt; \n" ; echo "&lt;/select&gt;&lt;/font&gt;\n"; ?&gt; &lt;form method="post" align= "right"&gt; &lt;table &gt; &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;tr&gt; &lt;td style="text-align: left; "&gt;Criminal &lt;/td&gt; &lt;td align="left" &gt; &lt;input type="checkbox" name="mattertype" value="1" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;tr&gt; &lt;td style="text-align: left; "&gt;Labour &lt;/td&gt; &lt;td align="left" &gt; &lt;input type="checkbox" name="mattertype" value="1" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;tr&gt; &lt;td style="text-align: left; "&gt;Civil &lt;/td&gt; &lt;td align="left" &gt; &lt;input type="checkbox" name="mattertype" value="1" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;tr&gt; &lt;td style="text-align: left; "&gt;Active &lt;/td&gt; &lt;td align="left" &gt; &lt;input type="checkbox" name="active" value="1" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;tr&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&lt;input type="submit" name="submit" value="Add" align= "right" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>How would i write the php code to insert the following information as a new record for all the checked checkboxes? For example, i have checked Civil, Labour and Active. I now want the first record that must be inserted to read</p> <p>Firm Area Mattertype Active (my sql table)</p> <p>value of categoria value of subcategoria Civl 1<br> value of categoria value of subcategoria Labour 1 </p> <p>If any or all of the civil, labour or criminal checkboxes are ticked it must insert the value of categoria, value of subcatgoria, first ticked checkbox (mattertype) and if active is ticked then a 1 for active .</p> <p>Then for the second record again value of categoria, value of subcatgoria, second ticked checkbox (mattertype) and if active is ticked then a 1 for active .</p> <p>And so on. I hope this makes sense.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload