<?php
require('currencyconverter.class.php');
$amount = $_POST['amount'];
$from = $_POST['fromcurr'];
$to = $_POST['tocurr'];
$conversion = new currencyConverter($amount,$from,$to);
@$res = $conversion->convert();
if(!is_numeric($amount)){
echo "<br><span style='background-color:red;padding:5px;color:#fff;'>Invalid amount.</span>";
}elseif($from == $to){
echo "<br><span style='background-color:red;padding:5px;color:#fff;'>Please select distinct currencies.</span>";
}elseif($res == "0"){
echo "<br><span style='background-color:red;padding:5px;color:#fff;'>Exchange Rate not available.</span>";
}else{
echo "<br><span style='background-color:lime;padding:5px;'>".$amount." ".$from." = ".$res." ".$to."</span>";
}
|