Hello again with my form return this time I have problems with a checkbox by the way and try the hidden button that I'm not so lazy search in Google and it worked but for a single input but I realized that by sending several inputs I I marked an error, since I generate inputs dynamically with jquery, I would appreciate your help to mark the input with a value for example "No" by not selecting the ckeckbox. Either on the client side or on the server side. By the way, it's an array called tagging that I want to insert into the database.
<script>
$(document).ready(function() {
var max_fields = 10;
var wrapper = $(".container1");
var add_button = $(".add_form_field");
var x = 1;
$(add_button).click(function(e){
e.preventDefault();
if(x < max_fields){
x++;
var selectproductos = "<?php $sql = "Select producto from productos"; $query = $db->prepare($sql);
$query->execute();
while($row = $query->fetch(PDO::FETCH_ASSOC)) {
echo '<option>'.$row['producto'].'</option>';
}
?>";
var selectunidades = "<?php $sql = "Select unidad from unidades";
$query = $db->prepare($sql);
$query->execute();
while($row = $query->fetch(PDO::FETCH_ASSOC)) {
echo '<option>'.$row['unidad'].'</option>';
}
?> ";
$(wrapper).children('table').append('<tr> <td> <select required name="productos[]"><option value="">Selecciona un Producto</option>'+selectproductos+'</select><td><select required name ="unidad[]"><option value="">Selecciona una unidad</option>'+selectunidades+'</select></td><td><input type="text" class="inputancho" name="cantidad[]" placeholder="cantidad" required="required"/></td><td><input type="date" name="fecha_de_embarque[]" required="required"/></td> <td> <textarea rows="2" cols="30" name="notas[]" id="notas" maxlength="255"></textarea> </td> <td><input type="checkbox" name="etiquetado[]" value="Si"> </td><td><a href="#" class="delete">Eliminar</a></<td></tr>'); //add input box
}
else
{
alert('You Reached the limits')
}
});
$(wrapper).on("click",".delete", function(e){
e.preventDefault(); $(this).parent('td').parent('tr').remove(); x--;
})
});
</script>
<input type="hidden" name="etiquetado[]" value="No" />
<input type="submit" name="Submit" onclick="GetTextValue()" id="submit-pedidos" value="Enviar" class="bt"/>
</form>