PHP Classes

File: results.php

Recommend this page to a friend!
  Classes of Irshad Ali Jan   Currency Conversion   results.php   Download  
File: results.php
Role: Example script
Content type: text/plain
Description: fetches results
Class: Currency Conversion
Convert currency amounts using Google Finance
Author: By
Last change:
Date: 9 years ago
Size: 753 bytes
 

Contents

Class file image Download
<?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>";
}