In java code i have this
ArrayList<NameValuePair> al = new ArrayList<NameValuePair>();
for (int i = 0; i < alitems.size(); i++) {
al.add(new BasicNameValuePair("items[]", alitems.get(i)));
al.add(new BasicNameValuePair("qty[]", alnoof.get(i)));
al.add(new BasicNameValuePair("price[]", alprice.get(i)));
}
Note: here alitems, alnoof, alprice are ArrayLists
php code
foreach (array_combine($_POST['items'], $_POST['qty']) as $val => $no) {
$v = mysql_real_escape_string($val);
$va = mysql_real_escape_string($no);
}
now i am able to get 2 array values of $v and $va but I am not able to get the price arraylist. How to do it?
suppose $_POST['items']={pencil,pen,watch}
$_POST['qty']={2,3,4}
$_POST['price']={20,30,40}
i need to insert values in database as :
pencil,2,20 pen,3,30 watch,4,40
Kindly help me on how to achieve this.