<?php
include 'load.php';


$cname = $_POST['customer_name1'];
$cemail = $_POST['customer_email1'];
$cphone = $_POST['customer_phone1'];
$caddress = $_POST['customer_address1'];
$route = $_POST['route1'];
$ccredit = $_POST['ccredit1'];

		$comission = 0;
		$status = 1;
$branch_id = 1;

$stmt = $DB_con->prepare('INSERT INTO mobilecustomers(cname,cemail,cphone,caddress,route,credit_limit,status,comission,branch_id) VALUES(:cname,:cemail,:cphone,:caddress,:route,:ccredit,:status,:comission,:branch_id)');
			$stmt->bindParam(':cname',$cname);
			$stmt->bindParam(':cemail',$cemail);
			$stmt->bindParam(':cphone',$cphone);
			$stmt->bindParam(':caddress',$caddress);
			$stmt->bindParam(':route', $route);
			$stmt->bindParam(':ccredit',$ccredit);
			$stmt->bindParam(':status',$status);
			$stmt->bindParam(':comission',$comission);
			$stmt->bindParam(':branch_id',$branch_id);
			
			if($stmt->execute())

			{

				$customerinfo = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM mobilecustomers ORDER BY coid DESC LIMIT 1"));
    	
                $coid = $customerinfo["coid"];
                                        $creditbalance = $customerinfo["ccredit"];
                                        $cname = $customerinfo["cname"];
                                        $cphone = $customerinfo["cphone"];
                                        echo '<option value="' . $coid . '">' . $cname . ' | ' . $cphone . ' | Rs.' . $creditbalance . '</option>';
				

			}

			

?>