<?php
include_once 'db_functions.php'; 
$db = new DB_Functions(); 
$json = $_REQUEST["taskJSON"];
if (get_magic_quotes_gpc()){ 
	$json = stripslashes($json); 
}
//Decode JSON into an Array 
$data = json_decode($json); 
//print_r($data);
//Util arrays to create response JSON 
$a=array();
$b=array();

for($i=0; $i<count($data) ; $i++) {
	//Store User into MySQL DB 
	$res = $db->save_task($data[$i]->taskname,$data[$i]->visit_date,$data[$i]->task_sub,$data[$i]->visit_type,$data[$i]->transactional_type,$data[$i]->retailer_name,$data[$i]->owner_name,$data[$i]->contact_number,$data[$i]->amount,$data[$i]->create_by,$data[$i]->collection_amount,$data[$i]->billing_amount);
	//Based on inserttion, create JSON response     
 	array_push($a,$res);  
}
//Post JSON response back to Android Application 
echo json_encode($a); 
?>


