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

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

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