php - How can I bind quantity (input of type number) and item (input of type checkbox) in HTML? -


i have list of dynamically generated items (in php) , have let user chose quantity each item, how can bind (and distinguish) each input of type number corresponding item? each item has code attribute "value" , give names (attribute "name") "numitems_".$itemcode input tags of i'm not sure clean solution.

there several ways of doing this.

i set name of inputs array:

echo '<input type="number" name="numitems['.$itemcode.']" />'; 

then can check this:

foreach($_post['numitems'] $code => $number){   echo 'value of '.$code.' is: '.$number; } 

Comments

Popular posts from this blog

javascript - How to name a jQuery function to make a browser's back button work? -

python - Django-easy-pdf: xhtml2pdf reporting reportlab 2.2+ is required, but 3.0 installed -

collision detection - C++ library for mesh to mesh intersection: what is available? -