I have a form in html that has a field where the user inserts the data as shown in the code below, this form is dynamic and the user can insert as much information as he wants, in the following case I put only six systems. / p>
My question is: How will I receive this amount of information in PHP by $ _POST and insert into the bank? The query I even know how to do, but I know I have to work with a repeat structure, but how?
HTML code:
<div id="container">
<ul class="tags">
<li class="addedTag">
sistema1
<span class="tagRemove" onclick="$(this).parent().remove();">x</span>
<input type="hidden" value="sistema1" name="tags[]"/>
</li>
<li class="addedTag">
sistema2
<span class="tagRemove" onclick="$(this).parent().remove();">x</span>
<input type="hidden" value="sistema2" name="tags[]"/>
</li>
<li class="addedTag">
sistema3
<span class="tagRemove" onclick="$(this).parent().remove();">x</span>
<input type="hidden" value="sistema3" name="tags[]"/>
</li>
<li class="addedTag">
sistema4
<span class="tagRemove" onclick="$(this).parent().remove();">x</span>
<input type="hidden" value="sistema4" name="tags[]"/>
</li>
<li class="addedTag">
sistema5
<span class="tagRemove" onclick="$(this).parent().remove();">x</span>
<input type="hidden" value="sistema5" name="tags[]"/>
</li>
<li class="addedTag">
sistema6
<span class="tagRemove" onclick="$(this).parent().remove();">x</span>
<input type="hidden" value="sistema6" name="tags[]"/>
</li>
<li class="tagAdd taglist">
<input type="text" id="search-field"/>
</li>
</ul>
</div>
PHP:
<?php
$tags = $_POST['tags'];
$query = mysqli_query($dbc, ""INSERT INTO tb_conhecimentos .......
?>