<?php  include 'topmost.php';
if(!empty($_POST['name'])){ $id = $results['id'];

QueryDB("INSERT INTO enquiry VALUES ('','{$_POST['name']}','{$_POST['phone']}','{$_POST['program']}','".date('Y-m-d H:i:s')."','{$_POST['sex']}','{$_POST['rmk']}','0','{$_POST['email']}','$id','".date('m')."','".date('Y')."') ");

if($_POST['sendSMS']==1){
 $receiver = trim($_POST['phone']);
 $postdata = http_build_query(array('username' => SMSPROVIDER_EMAIL,'password' => SMSPROVIDER_PASSWORD,'message'=>'Hi '.$_POST['name'].' thank you for your interest in learning Practical '.get_course_name($_POST['program']).'.We hope you start soon.Wish you the Best. BRAINPALS PROG. ACADEMY','mobiles' => $receiver,'sender' => $sender,));
$result = sms_provider(SMSPROVIDER_ENDPOINT , $postdata);
$decode = json_decode($result);
echo 'Enquiry Recorded.';
}else{echo 'Enquiry Recorded.';}

}


//Change Course
if(isset($_POST['selected_course'])){echo  get_course_price(collect('selected_course'));}




if(isset($_POST['item_selected'])){echo  getCost(collect('item_selected'));}

if(isset($_POST['item_id'])){
	QueryDB("UPDATE courses set crs_title ='".collect('val_enteered')."' where id='".collect('item_id')."' ");
}



//update Course or Add New One
if(isset($_POST['where'])){
	if(is_numeric($_POST['where'])){
		$pr = getCost($_POST['where']);
		$time = get_duration($_POST['where']);
		$name = get_course_name($_POST['where']);
		$desc =get_desc($_POST['where']);
		$regCost =crs_Reg($_POST['where']);
		$crsSort =sort_code($_POST['where']);
		$crsCert =sort_Cert($_POST['where']);

		


	}

	echo $pr.'-'.$time.'-'.$name.'-'.$desc.'-'.$regCost.'-'.$crsSort.'-'.$crsCert;
}




?>
 <?php
if(isset($_POST['stateIdN'])){
    foreach(QueryDB("SELECT * FROM states WHERE country_id ='".$_POST['stateIdN']."' ")as $st){?>
        <option value="<?php  echo $st['name']; ?>" id="<?php echo $st['name']; ?>"><?php  echo $st['name']; ?></option>
<?php  } }

if(isset($_POST['storedID'])){ //echo tabRes($_SESSION['destination']);
	echo $linkr->getProductCost($_POST['storedID'],tabRest($_POST['myprice']));
// myprice
}

if(isset($_POST['sel_customer'])){
$getIt = QueryDB("SELECT * FROM customers where id='".$_POST['sel_customer']."' ");
$rows = $getIt->fetch(PDO::FETCH_ASSOC);
echo $rows['frm_name'].'-'.$rows['frm_phone'].'-'.$rows['gender'].'-'.$rows['frm_email'].'-'.$rows['cus_type'].'-'.$rows['address'].','.$rows['state'].','.$rows['country'];

}

?>