Location: PHPKode > scripts > Free PHP Ajax Currency Rate Exchanger Calculator > free-php-ajax-currency-rate-exchanger-calculator/ajax.php
<?php
/*
This script was downloaded at:
LightPHPScripts.com
Please support us by visiting
out website and letting people
know of it.
Produced under: LGPL
*/

// Include Class
include_once('currencyClass.php');

// Get list of currencies
$c = new JOJO_Currency_yahoo();
$list = $c->getCurrencies();

// Check any submitions
if($_GET['N'] != NULL){
	// Amount to convert
	$amount = (int)$_GET['N'];
	// From
	$from = $_GET['F'];
	$from_text = $list[$from];
	// To
	$to = $_GET['T'];
	$to_text = $list[$to];
	// Get rate
	$rate = $c->getRate($from,$to, true);
	// Total price (to 2 decemial points)
	$total = number_format(($rate*$amount),2);
}



if($total != NULL){?>
  <table width="790"  border="1" align="center" cellpadding="5" cellspacing="0">
    <tr>
      <td width="100%"><div align="center"><strong><font color="#0000FF" size="4" face="Georgia, Times New Roman, Times, serif">Exchange Rate </font></strong></div></td>
    </tr>
    <tr>
      <td><div align="center"><strong>Exchange Rate is</strong> <font color="#FF0000">$<?=$rate;?>, <?=$amount;?></font> <strong><?=$from_text;?> will tend</strong> <font color="#FF0000">$<?=$total;?></font> <strong><?=$to_text;?></strong>. </div></td>
    </tr>
  </table>
  <br/>
<?php } ?>
Return current item: Free PHP Ajax Currency Rate Exchanger Calculator