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
Post a Comment