<?
ob_start();
session_start();

include("include/config.php");
$value ='';
$id='';$billtype='';$type='';
if(isset($_REQUEST['id']))
{
$id=mysql_escape_string($_REQUEST['id']);
}
if(isset($_REQUEST['clientid']))
{
$clientid=mysql_escape_string($_REQUEST['clientid']);
}
if(isset($_REQUEST['value'])){
$value=mysql_escape_string($_REQUEST['value']);
}
if(isset($_REQUEST['billtype'])){
$billtype=mysql_escape_string($_REQUEST['billtype']);
}

if(isset($_REQUEST['type']))
{
		$type=mysql_escape_string($_REQUEST['type']);
}
	
		if($type=="billtype"){
		$sq_arr1="update cf_rate set ".$type."='".$value."' where client_code = '".$clientid."' ";
		mysql_query($sq_arr1);
		if($billtype!="Pack Billing")
			{
				$sq_arr="update cf_rate set packname='' where client_code = '".$clientid."' ";
				
			}
		}
		else
		{
			$sq_arr="update cf_rate set ".$type."='".$value."' where id = '".$id."' ";
			mysql_query($sq_arr);
			if($billtype!="Pack Billing")
			{
				$sq_arr="update cf_rate set packname='' where client_code = '".$clientid."' ";
				
			}
		}
		$qry=mysql_query($sq_arr);
		echo 'Successfully Saved';
		exit;
?>