Intentar crear un formulario que pueda tener filas agregadas cuando se necesitan filas adicionales y enviar el formulario a una base de datos con php y jquery. Puedo agregar las filas, pero cuando se envía el formulario, se omiten de la respuesta. ¿Alguien puede aclarar qué está mal?
codigo para formulario
<table class="material-form"> <thead> <tr style="display: flex; flex-direction: row; justify-content: space-around;"> <th>Sku</th> <th>Description</th> <th>Order</th> </tr> </thead> <?php $attributes = array('name' => 'count_form'); echo form_open_multipart('request/C_request/new_material_request?wh=' . strtolower($warehouse['warehouse_name']) , $attributes); ?> <div > <tbody style="display: flex; flex-direction: column;"> <tr id="rows"> <td><input type="textarea" id="sku" name="sku[]" onblur="sumFunction()" style="font-size: 30px; background-color: #DCDCDC; height: 80%; margin-right: 15px" class="col-md-4" ></td> <td><input type="textarea" id="sku" name="sku[]" onblur="sumFunction()" style="font-size: 30px; background-color: #DCDCDC; height: 80%; margin-right: 15px" class="col-md-4" ></td> </tr> </tbody> </div> </table> <div id="add-row" >add row<p id="counter"></p></div> <button type="button" class="btn btn-primary btn-lg" id="accept-count" style="">submit</button>código para enviar
jQuery(document).ready(function ($) { $('#add-row').click(function() { $('#rows').prepend('<td><input type="textarea" id="sku" name="sku[]" onblur="sumFunction()" style="font-size: 30px; background-color: #DCDCDC; height: 80%; margin-right: 15px" class="col-md-4" ></td>' ) }) $('#accept-count').click(function () { document.count_form.submit(); }); });Tienes HTML no válido. El navegador intenta averiguar lo que está haciendo y lo representa. No puede tener un elemento form y div como elemento secundario de una tabla. Su html debería verse como
<form> <table> <thead> </thead> <tbody> </tbody> </table> </form>Ahora, por la forma en que estás jugando con el css y usando flex, no estoy seguro de por qué estás usando una tabla.