$check_suffix = mysql_query("select count(*) as num from billing where BILL_DATE= current_date()") or die (mysql_error());
$num = mysql_fetch_row($check_suffix);
$credit = $_POST["credit"];
if($credit == 15){
$str = 'bill 15 days';
}else{
$str = 'bill 30-60 days';
}
$enddate = date('Y-m-d', strtotime('+'.$_POST["credit"].' day')) ;
echo $enddate;
$getduedate = mysql_query("select DATE from calendar where TYPE = '".$str."' and DATE >= '".$enddate."' and month(DATE) = month('".$enddate."') order by DATE asc limit 1");
$duedate= mysql_fetch_row($getduedate);