Dynamically insert new row using javascript, but how to save these multiple row in php/mysql -



Dynamically insert new row using javascript, but how to save these multiple row in php/mysql -

i have create multiple row using javascript. how save these row in mysql. using type of code, not working. here code [http://jsfiddle.net/bb2pj/] , php code adding these value.

` include "config.php"; if(isset($_post['submit'])) { foreach ($_post['code1'] $key => $value) { $code1 = $_post["code1"][$key]; $product1 = $_post["product_name1"][$key]; $qty = $_post["quantity1"][$key]; $rate = $_post["amount_name1"][$key]; $total = $_post["total_name1"][$key]; $sql = mysql_query("insert testing(code,product,qty,rate,total)values('$code1','$product1','$qty1','$rate1','$total1')")or die(mysql_error()); } } ?>`

from js fiddle code, trying post array of values each field (ie code, proddname, ...).

how submitting these values? if not passing through ajax post, need declare fields names code[], product_name[] ... array fields submitted array.

rest code have writtten above should work using proper field name code code[] ... .

please set proper spacing between keywords , values/fieldname in insert into.. statement.

javascript php html mysql

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -