<?php
 $dateFind=$_POST['dateFind'];
  
 $currencyId=$_POST['currencyId'];
 

      include("db.php");
	  
	 if($currencyId==""){

     echo "لطفا واحد پولی را انتخاب کنید";
	 die;
     } 

        $courncyName_Sql="select name from currencies where id='$currencyId' ";
        $courncyName_Query= $db ->query($courncyName_Sql);
	    $courncyName_Row= $courncyName_Query ->fetch_array();
	    $courncyName=$courncyName_Row['name']; 

	    $counterSql="select rate from crrencyrate where counterCurrency='$currencyId' and baseCurrency='1'     ORDER BY id desc  LIMIT 1";
		$counterQuery= $db ->query($counterSql);
		$counterRow= $counterQuery ->fetch_array();
		$counterRate=$counterRow['rate'];
	 
 
 
  if(!isset($counterRate) ){
	 echo "لطفا نرخ ".$courncyName."&nbsp;به دالر را مشخص کنید";
	 die;
	}
  
 
 
 
  

	     echo ' <input type="text" name="dollarRate" id="dollarRate" placeholder="" class="form-control" value='.number_format($counterRate,6).' />';
        
   

?>