<?php
   include("db.php");
    $ccurrencyId=$_POST['cCurrency'];
	$basecurrencyId=$_POST['bCurrency'];
	include("newPlagin.php"); 
	
	/* if($ccurrencyId==""){
	   echo "لطفا ارز مورد معاوضه را انتخاب کنید";
	
	die;
	}
 //====================================================================================
									 
 //====================================================================================
 //counter Currency Name
        $courncyName_Sql="select name from currencies where id='$ccurrencyId' ";
        $courncyName_Query= $db ->query($courncyName_Sql);
	    $courncyName_Row= $courncyName_Query ->fetch_array();
	    $courncyName=$courncyName_Row['name']; 
  
        //base currency Name
		$basecourncyName_Sql="select name from currencies where id='$basecurrencyId' ";
        $basecourncyName_Query= $db ->query($basecourncyName_Sql);
	    $basecourncyName_Row= $basecourncyName_Query ->fetch_array();
	    $basecourncyName=$basecourncyName_Row['name']; 
  
         
  
  
  
		 //if($ccurrencyId!=1){
		$counterSql="select unit,rate from crrencyrate where counterCurrency='$ccurrencyId' and baseCurrency='$basecurrencyId'  ORDER BY id desc  LIMIT 1";
		$counterQuery= $db ->query($counterSql);
		$counterRow= $counterQuery ->fetch_array();
		$counterRate=$counterRow['rate'];
		$unit=$counterRow['unit'];
 if(!isset($counterRate) ){
	 echo "لطفا نرخ ".$courncyName."&nbsp;به &nbsp;".$basecourncyName."&nbsp;را مشخص کنید&nbsp;";
	 die;
	}
  //$result=number_format($baseRate/$counterRate,3);  
  
  echo "<input type='text' name='currencyPriec' id='currencyPriec'  class='form-control' id='take' value=".$counterRate.">";
   
  echo "<input type='hidden' class='form-control' name='unit' id='unit' value=".$unit.">";
    */
?>