I have the following dump from the form on which I am working and I need to put the data in MySQL. My problem is that I am a little confused about how I can handle data from the form (how to do it or to find a better way to handle it).
Dump: This will help transform the array A friendly format: You can loop over to Note that it does not check that the array key is present and it assumes that there will always be quantity and value for each product name. array (4) ["product_name_" => Array (2) [0 = & gt; String (10) "Top Horti" 2 = & gt; String (7) "Pix Gel"] "Quantity_" => Array (2) [0 = & gt; String (1) "2" 2 = & gt; String (1) "3"] "price_" = & gt; Array (2) [0 = & gt; String (3) "200" 2 = & gt; String (2) "10"] "submit" = & gt; String (6) "Submit"]
$ myData = array (); $ {$ MyData [] = array ('name' = & gt; $ item, 'quantity' => $ formData ['quantity _'] [$] $ $ key] 'value' = & gt; $ formData ['Value'] [$ key]); }
$ myData to insert.
No comments:
Post a Comment