php - Getting data from checkbox from multi-dimentional array -


i have form consist of multi-d array. has both checkbox , text. use both values enter them in database. not figure out how use them. appreciated. here code ;

 $clothes = array(               "for_man"=>array("suit", "tie"),               "for_woman"=>array("skirt","bra")                 );     echo '<form action="" method="post">';   foreach ($clothes $cloth => $task) {     echo "<strong>{$cloth}</strong> <br />";   foreach ($task $type){     echo "<input type=\"checkbox\" name=\"box[]\" value=\"{$type}\" />\r    {$type} <input type=\"textbox\" name=\"note[]\" size=\"2\" /><hr />\r";    }  }      echo "<input type=\"submit\" name=\"submit\" value=\"submit\" />\r     </form>";   if(isset($_post['box'])){  if(isset($_post['note'])){     $note = $_post['note'];   }  $box = $_post['box'];  } 

so user can select item , enter amount want can use enter database like

new_order = mysql_query("insert orders(cloth_name, amount,... ) values     ('$box', '$note', ..........."); 

i don't understand you, want save each product of array in database? if case can put in table know,

=products=

id_product

name

=orders

id_order

...

=products_orders

id_po

id_product

id_order

amount

note

instead of putting information in unique table.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -