Ads 468x60px

Thursday, August 1, 2013

Current Currency convertor USD to INR

<?php
$url  = "http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency=USD&ToCurrency=INR";

$xml = simplexml_load_file($url);
echo $xml;

?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<?php
$url  = "http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency=USD&ToCurrency=INR";

$dollar = simplexml_load_file($url);
//echo $dollar;

if(isset($_POST['INR']) || isset($_POST['USD']))
{
    if(isset($_POST['INR']) && $_POST['INR']!="")
    {
        $inr = (1/$dollar)*$_POST['INR'];
        echo "<h2>Current Value for ".$_POST['INR']." INR is : <b>".$inr."$</b><h2><br>";
    }
    if(isset($_POST['USD']) && $_POST['USD']!="")
    {
        $usd = $dollar*$_POST['USD'];
        echo "<h2>Current value for ".$_POST['USD']." USD is : <b>Rs.".$usd."</b></h2><br>";
    }
   
}
else
    {
        echo "Please enter a value and press calculate<br>";
    }
?>
<h1>Current Currency Convertor</h1>
<form action="./convertor.php" method="post">
    Indian Rupees : <input type="text" name="INR" alt="Enter the INR number here"/>
    US Dollar : <input type="text" name="USD" alt="Enter the USD number here" />
    <input type="submit" value="Calculate" />
</form>
</body>
</html>


This is the code for that you can test directly....
To test this page click here

0 comments:

Post a Comment

 

Sample text

Sample Text

Sample Text