jquery - Only getting one element from html array in my php file -


i have select in html form:

<form name="correo" id="correo" method="post" action="#" enctype="multipart/form-data" onsubmit="<!--return checkfields();-->" ><div class="multi-field-wrapper" name="multi-field-wrapper">                     <div class="multi-fields" name="multi-fields">                         <div class="multi-field" name="multi-field">                             <div>                                 <label for="penviadas[]"> cantidad </label>                                 <input type="number" name="penviadas[]" class="penviadas" id="penviadas" maxlength="70" placeholder="¿cuántas?" onclick="removericon('iconcant');" >                              </div>                          </div>                     </div>                     <button type="button" class="add-field">añadir otra referencia</button>                 </div> 

and can add fields dynamically (or what's same, can repeat code above many times; code below works).

$('.multi-field-wrapper').each(function() {   var $wrapper = $('.multi-fields', this);   $(".add-field", $(this)).click(function(e) {     $('.multi-field:first-child', $wrapper).clone(true).appendto($wrapper).find('input').val('').focus();   });   $('.multi-field .remove-field', $wrapper).click(function() {     if ($('.multi-field', $wrapper).length > 1)       $(this).parent('.multi-field').remove();   }); }); 

let's have 3 different selects (penviadas). want of them in php file once submit form. it used work, now, reason, can first select (penviadas). why not getting values penviadas array?

pd: print in php in different ways return first element penviadas, not rest:

var_dump($_request['penviadas']); 

i figured out after many hours playing stupid. information in op impossible discover there problem. found solution here: submitting form different <div> html

basically, had structure:

<div... <form... </div... </form> 

i thought alright , didn't think moment affecting. thus, wasn't php/js html tags incorrect. time.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -