d7f49899d09d4dd84f5105080c780de5 here i attached one image. look at this.if i selected the Guest Currency then automatically Guest Currency Value should shown in the next text box. how to do that? is there any javascript, jquery plugin?

Guest Currency :

<select name="gcurrency" tabindex="21">
    <option value=""></option>
     <option>
        INR India Rupees
    </option>
    <option>
        USD United States Dollars
    </option>
    <option>
        EUR Euro
    </option>
    <option>
        CAD Canada Dollars
    </option>
    <option>
        GBP United Kingdom Pounds
    </option>
    <option>
        DEM Germany Deutsche Marks
    </option>
    <option>
        FRF France Francs
    </option>
    <option>
        JPY Japan Yen
    </option>
    <option>
        NLG Netherlands Guilders
    </option>
    <option>
        ITL Italy Lira
    </option>
    <option>
        CHF Switzerland Francs
    </option>
    <option>
        DZD Algeria Dinars
    </option>
    <option>
        ARP Argentina Pesos
    </option>
    <option>
        AUD Australia Dollars
    </option>
    <option>
        ATS Austria Schillings
    </option>
    <option>
        BSD Bahamas Dollars
    </option>
    <option>
        BBD Barbados Dollars
    </option>
    <option>
        BEF Belgium Francs
    </option>
    <option>
        BMD Bermuda Dollars
    </option>
    <option>
        BRR Brazil Real
    </option>
    <option>
        BGL Bulgaria Lev
    </option>
    <option>
        CAD Canada Dollars
    </option>
    <option>
        CLP Chile Pesos
    </option>
    <option>
        CNY China Yuan Renmimbi
    </option>
    <option>
        CYP Cyprus Pounds
    </option>
    <option>
        CSK Czech Republic Koruna
    </option>
    <option>
        DKK Denmark Kroner
    </option>
    <option>
        NLG Dutch Guilders
    </option>
    <option>
        XCD Eastern Caribbean Dollars
    </option>
    <option>
        EGP Egypt Pounds
    </option>
    <option>
        EUR Euro
    </option>
    <option>
        FJD Fiji Dollars
    </option>
    <option>
        FIM Finland Markka
    </option>
    <option>
        FRF France Francs
    </option>
    <option>
        DEM Germany Deutsche Marks
    </option>
    <option>
        XAU Gold Ounces
    </option>
    <option>
        GRD Greece Drachmas
    </option>
    <option>
        HKD Hong Kong Dollars
    </option>
    <option>
        HUF Hungary Forint
    </option>
    <option>
        ISK Iceland Krona
    </option>
    <option>
        IDR Indonesia Rupiah
    </option>
    <option>
        IEP Ireland Punt
    </option>
    <option>
        ILS Israel New Shekels
    </option>
    <option>
        ITL Italy Lira
    </option>
    <option>
        JMD Jamaica Dollars
    </option>
    <option>
        JPY Japan Yen
    </option>
    <option>
        JOD Jordan Dinar
    </option>
    <option>
        KRW Korea (South) Won
    </option>
    <option>
        LBP Lebanon Pounds
    </option>
    <option>
        LUF Luxembourg Francs
    </option>
    <option>
        MYR Malaysia Ringgit
    </option>
    <option>
        MXP Mexico Pesos
    </option>
    <option>
        NLG Netherlands Guilders
    </option>
    <option>
        NZD New Zealand Dollars
    </option>
    <option>
        NOK Norway Kroner
    </option>
    <option>
        PKR Pakistan Rupees
    </option>
    <option>
        XPD Palladium Ounces
    </option>
    <option>
        PHP Philippines Pesos
    </option>
    <option>
        XPT Platinum Ounces
    </option>
    <option>
        PLZ Poland Zloty
    </option>
    <option>
        PTE Portugal Escudo
    </option>
    <option>
        ROL Romania Leu
    </option>
    <option>
        RUR Russia Rubles
    </option>
    <option>
        SAR Saudi Arabia Riyal
    </option>
    <option>
        XAG Silver Ounces
    </option>
    <option>
        SGD Singapore Dollars
    </option>
    <option>
        SKK Slovakia Koruna
    </option>
    <option>
        ZAR South Africa Rand
    </option>
    <option>
        KRW South Korea Won
    </option>
    <option>
        ESP Spain Pesetas
    </option>
    <option>
        XDR Special Drawing Right (IMF)
    </option>
    <option>
        SDD Sudan Dinar
    </option>
    <option>
        SEK Sweden Krona
    </option>
    <option>
        CHF Switzerland Francs
    </option>
    <option>
        TWD Taiwan Dollars
    </option>
    <option>
        THB Thailand Baht
    </option>
    <option>
        TTD Trinidad and Tobago Dollars
    </option>
    <option>
        TRL Turkey Lira
    </option>
    <option>
        GBP United Kingdom Pounds
    </option>
    <option>
        USD United States Dollars
    </option>
    <option>
        VEB Venezuela Bolivar
    </option>
    <option>
        ZMK Zambia Kwacha
    </option>
    <option>
        EUR Euro
    </option>
    <option>
        XCD Eastern Caribbean Dollars
    </option>
    <option>
        XDR Special Drawing Right (IMF)
    </option>
    <option>
        XAG Silver Ounces
    </option>
    <option>
        XAU Gold Ounces
    </option>
    <option>
        XPD Palladium Ounces
    </option>
    <option>
        XPT Platinum Ounces
    </option>
</select>

Guest Currency Value :

<input type="text" name="gcurrencyvalue" tabindex="22" />

here i don't know the currency value for all countries. how can i get the currency values? any help would be appreciated.

thats ok @aarti shrivas. but i dont know currency values. what to do?

Hi,

Try this...

Member Avatar for diafol

I was just about to suggest that very website - you beat me to it :)

However, here's a hard-coded example utilising php and a little bit of jQ...

<?php
    $rates = json_encode(array('INR'=> 62.3, 'USD'=> 1, 'GBP'=> 0.63));
?>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<label for="from">From:</label>
<select id="from">
    <option value="INR">INR</option>
    <option value="USD" selected>USD</option>
    <option value="GBP">GBP</option>
</select> <br />

<label for="amount">Amount: </label>
<input id= "amount" value='1' />

<label for="to">To:</label>
<select id="to">
    <option value="INR" selected>INR</option>
    <option value="USD">USD</option>
    <option value="GBP">GBP</option>
</select>

<div id="conversion"></div>

<script src="js/jquery.js"></script>
<script>
 var rates = <?php echo $rates;?>;

changeConversion();

$('#to, #from, #amount').change(function(){
    changeConversion();
});

function changeConversion()
{
    var fromKey = $('#from').val();
    var from = rates[fromKey];

    var toKey = $('#to').val();
    var to = rates[toKey];

    var amt = parseFloat($('#amount').val());

    var ans = parseFloat(to / from  * amt).toFixed(2);

    $('#conversion').html(ans);

}

</script>
</body>
</html>

Please note - not meant as a compelte solution - just a few ideas. The dropdowns can be produced dynamically from an array (or copy the one from veedeoo's link).

//EDIT
For as pure js...

http://jsfiddle.net/egCPL/

@ veedeoo partially got it but if i change the currency dropdown option then currency value does not change.. how can i change that currency value based upon the dropdown list value..

<select name='currencies'>
   <option value='AED' title='United Arab Emirates Dirham'>AED</option>
   <option value='AFN' title='Afghan Afghani'>AFN</option>
   <option value='ALL' title='Albanian Lek'>ALL</option>
   <option value='AMD' title='Armenian Dram'>AMD</option>
   <option value='ANG' title='Netherlands Antillean Guilder'>ANG</option>
   <option value='AOA' title='Angolan Kwanza'>AOA</option>
   <option value='ARS' title='Argentine Peso'>ARS</option>
   <option value='AUD' title='Australian Dollar'>AUD</option>
   <option value='AWG' title='Aruban Florin'>AWG</option>
   <option value='AZN' title='Azerbaijani Manat'>AZN</option>
   <option value='BAM' title='Bosnia-Herzegovina Convertible Mark'>BAM</option>
   <option value='BBD' title='Barbadian Dollar'>BBD</option>
   <option value='BDT' title='Bangladeshi Taka'>BDT</option>
   <option value='BGN' title='Bulgarian Lev'>BGN</option>
   <option value='BHD' title='Bahraini Dinar'>BHD</option>
   <option value='BIF' title='Burundian Franc'>BIF</option>
   <option value='BMD' title='Bermudan Dollar'>BMD</option>
   <option value='BND' title='Brunei Dollar'>BND</option>
   <option value='BOB' title='Bolivian Boliviano'>BOB</option>
   <option value='BRL' title='Brazilian Real'>BRL</option>
   <option value='BSD' title='Bahamian Dollar'>BSD</option>
   <option value='BTN' title='Bhutanese Ngultrum'>BTN</option>
   <option value='BWP' title='Botswanan Pula'>BWP</option>
   <option value='BYR' title='Belarusian Ruble'>BYR</option>
   <option value='BZD' title='Belize Dollar'>BZD</option>
   <option value='CAD' title='Canadian Dollar'>CAD</option>
   <option value='CDF' title='Congolese Franc'>CDF</option>
   <option value='CHF' title='Swiss Franc'>CHF</option>
   <option value='CLF' title='Chilean Unit of Account (UF)'>CLF</option>
   <option value='CLP' title='Chilean Peso'>CLP</option>
   <option value='CNY' title='Chinese Yuan'>CNY</option>
   <option value='COP' title='Colombian Peso'>COP</option>
   <option value='CRC' title='Costa Rican Colón'>CRC</option>
   <option value='CUP' title='Cuban Peso'>CUP</option>
   <option value='CVE' title='Cape Verdean Escudo'>CVE</option>
   <option value='CZK' title='Czech Republic Koruna'>CZK</option>
   <option value='DJF' title='Djiboutian Franc'>DJF</option>
   <option value='DKK' title='Danish Krone'>DKK</option>
   <option value='DOP' title='Dominican Peso'>DOP</option>
   <option value='DZD' title='Algerian Dinar'>DZD</option>
   <option value='EGP' title='Egyptian Pound'>EGP</option>
   <option value='ETB' title='Ethiopian Birr'>ETB</option>
   <option value='EUR' title='Euro'>EUR</option>
   <option value='FJD' title='Fijian Dollar'>FJD</option>
   <option value='FKP' title='Falkland Islands Pound'>FKP</option>
   <option value='GBP' title='British Pound Sterling'>GBP</option>
   <option value='GEL' title='Georgian Lari'>GEL</option>
   <option value='GHS' title='Ghanaian Cedi'>GHS</option>
   <option value='GIP' title='Gibraltar Pound'>GIP</option>
   <option value='GMD' title='Gambian Dalasi'>GMD</option>
   <option value='GNF' title='Guinean Franc'>GNF</option>
   <option value='GTQ' title='Guatemalan Quetzal'>GTQ</option>
   <option value='GYD' title='Guyanaese Dollar'>GYD</option>
   <option value='HKD' title='Hong Kong Dollar'>HKD</option>
   <option value='HNL' title='Honduran Lempira'>HNL</option>
   <option value='HRK' title='Croatian Kuna'>HRK</option>
   <option value='HTG' title='Haitian Gourde'>HTG</option>
   <option value='HUF' title='Hungarian Forint'>HUF</option>
   <option value='IDR' title='Indonesian Rupiah'>IDR</option>
   <option value='ILS' title='Israeli New Sheqel'>ILS</option>
   <option value='INR' title='Indian Rupee'>INR</option>
   <option value='IQD' title='Iraqi Dinar'>IQD</option>
   <option value='IRR' title='Iranian Rial'>IRR</option>
   <option value='ISK' title='Icelandic Króna'>ISK</option>
   <option value='JEP' title='Jersey Pound'>JEP</option>
   <option value='JMD' title='Jamaican Dollar'>JMD</option>
   <option value='JOD' title='Jordanian Dinar'>JOD</option>
   <option value='JPY' title='Japanese Yen'>JPY</option>
   <option value='KES' title='Kenyan Shilling'>KES</option>
   <option value='KGS' title='Kyrgystani Som'>KGS</option>
   <option value='KHR' title='Cambodian Riel'>KHR</option>
   <option value='KMF' title='Comorian Franc'>KMF</option>
   <option value='KPW' title='North Korean Won'>KPW</option>
   <option value='KRW' title='South Korean Won'>KRW</option>
   <option value='KWD' title='Kuwaiti Dinar'>KWD</option>
   <option value='KYD' title='Cayman Islands Dollar'>KYD</option>
   <option value='KZT' title='Kazakhstani Tenge'>KZT</option>
   <option value='LAK' title='Laotian Kip'>LAK</option>
   <option value='LBP' title='Lebanese Pound'>LBP</option>
   <option value='LKR' title='Sri Lankan Rupee'>LKR</option>
   <option value='LRD' title='Liberian Dollar'>LRD</option>
   <option value='LSL' title='Lesotho Loti'>LSL</option>
   <option value='LTL' title='Lithuanian Litas'>LTL</option>
   <option value='LVL' title='Latvian Lats'>LVL</option>
   <option value='LYD' title='Libyan Dinar'>LYD</option>
   <option value='MAD' title='Moroccan Dirham'>MAD</option>
   <option value='MDL' title='Moldovan Leu'>MDL</option>
   <option value='MGA' title='Malagasy Ariary'>MGA</option>
   <option value='MKD' title='Macedonian Denar'>MKD</option>
   <option value='MMK' title='Myanma Kyat'>MMK</option>
   <option value='MNT' title='Mongolian Tugrik'>MNT</option>
   <option value='MOP' title='Macanese Pataca'>MOP</option>
   <option value='MRO' title='Mauritanian Ouguiya'>MRO</option>
   <option value='MUR' title='Mauritian Rupee'>MUR</option>
   <option value='MVR' title='Maldivian Rufiyaa'>MVR</option>
   <option value='MWK' title='Malawian Kwacha'>MWK</option>
   <option value='MXN' title='Mexican Peso'>MXN</option>
   <option value='MYR' title='Malaysian Ringgit'>MYR</option>
   <option value='MZN' title='Mozambican Metical'>MZN</option>
   <option value='NAD' title='Namibian Dollar'>NAD</option>
   <option value='NGN' title='Nigerian Naira'>NGN</option>
   <option value='NIO' title='Nicaraguan Córdoba'>NIO</option>
   <option value='NOK' title='Norwegian Krone'>NOK</option>
   <option value='NPR' title='Nepalese Rupee'>NPR</option>
   <option value='NZD' title='New Zealand Dollar'>NZD</option>
   <option value='OMR' title='Omani Rial'>OMR</option>
   <option value='PAB' title='Panamanian Balboa'>PAB</option>
   <option value='PEN' title='Peruvian Nuevo Sol'>PEN</option>
   <option value='PGK' title='Papua New Guinean Kina'>PGK</option>
   <option value='PHP' title='Philippine Peso'>PHP</option>
   <option value='PKR' title='Pakistani Rupee'>PKR</option>
   <option value='PLN' title='Polish Zloty'>PLN</option>
   <option value='PYG' title='Paraguayan Guarani'>PYG</option>
   <option value='QAR' title='Qatari Rial'>QAR</option>
   <option value='RON' title='Romanian Leu'>RON</option>
   <option value='RSD' title='Serbian Dinar'>RSD</option>
   <option value='RUB' title='Russian Ruble'>RUB</option>
   <option value='RWF' title='Rwandan Franc'>RWF</option>
   <option value='SAR' title='Saudi Riyal'>SAR</option>
   <option value='SBD' title='Solomon Islands Dollar'>SBD</option>
   <option value='SCR' title='Seychellois Rupee'>SCR</option>
   <option value='SDG' title='Sudanese Pound'>SDG</option>
   <option value='SEK' title='Swedish Krona'>SEK</option>
   <option value='SGD' title='Singapore Dollar'>SGD</option>
   <option value='SHP' title='Saint Helena Pound'>SHP</option>
   <option value='SLL' title='Sierra Leonean Leone'>SLL</option>
   <option value='SOS' title='Somali Shilling'>SOS</option>
   <option value='SRD' title='Surinamese Dollar'>SRD</option>
   <option value='STD' title='São Tomé and Príncipe Dobra'>STD</option>
   <option value='SVC' title='Salvadoran Colón'>SVC</option>
   <option value='SYP' title='Syrian Pound'>SYP</option>
   <option value='SZL' title='Swazi Lilangeni'>SZL</option>
   <option value='THB' title='Thai Baht'>THB</option>
   <option value='TJS' title='Tajikistani Somoni'>TJS</option>
   <option value='TMT' title='Turkmenistani Manat'>TMT</option>
   <option value='TND' title='Tunisian Dinar'>TND</option>
   <option value='TOP' title='Tongan Pa?anga'>TOP</option>
   <option value='TRY' title='Turkish Lira'>TRY</option>
   <option value='TTD' title='Trinidad and Tobago Dollar'>TTD</option>
   <option value='TWD' title='New Taiwan Dollar'>TWD</option>
   <option value='TZS' title='Tanzanian Shilling'>TZS</option>
   <option value='UAH' title='Ukrainian Hryvnia'>UAH</option>
   <option value='UGX' title='Ugandan Shilling'>UGX</option>
   <option value='USD' title='United States Dollar'>USD</option>
   <option value='UYU' title='Uruguayan Peso'>UYU</option>
   <option value='UZS' title='Uzbekistan Som'>UZS</option>
   <option value='VEF' title='Venezuelan Bolívar'>VEF</option>
   <option value='VND' title='Vietnamese Dong'>VND</option>
   <option value='VUV' title='Vanuatu Vatu'>VUV</option>
   <option value='WST' title='Samoan Tala'>WST</option>
   <option value='XAF' title='CFA Franc BEAC'>XAF</option>
   <option value='XCD' title='East Caribbean Dollar'>XCD</option>
   <option value='XDR' title='Special Drawing Rights'>XDR</option>
   <option value='XOF' title='CFA Franc BCEAO'>XOF</option>
   <option value='XPF' title='CFP Franc'>XPF</option>
   <option value='YER' title='Yemeni Rial'>YER</option>
   <option value='ZAR' title='South African Rand'>ZAR</option>
   <option value='ZMK' title='Zambian Kwacha'>ZMK</option>
   <option value='ZWL' title='Zimbabwean Dollar'>ZWL</option>
</select>
<br />
<input type="text" value="
<?php
// Requested file
// Could also be e.g. 'currencies.json' or 'historical/2011-01-01.json'
$file = 'latest.json';
$appId = 'API ID';

// Open CURL session:
$ch = curl_init("http://openexchangerates.org/api/{$file}?app_id={$appId}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// Get the data:
$json = curl_exec($ch);
curl_close($ch);

// Decode JSON response:
$exchangeRates = json_decode($json);

// You can now access the rates inside the parsed object, like so:
printf(
    "1 %s in GBP: %s (as of %s)",
    $exchangeRates->base,
    $exchangeRates->rates->GBP,
    date('H:i jS F, Y', $exchangeRates->timestamp)
);
// -> eg. "1 USD in GBP: 0.643749 (as of 11:01, 3rd January 2012)"
?>" readonly="readonly" size="55" />

52d676610459b2681b34a4437545ef9e

@ diafol : thats good. but i want to display the currency value of all over the countries.. any idea?

Member Avatar for diafol

What I'd do is only query the API once an hour. Store the data as json and a timestamp - to tell you how old the data is.

So when you now change the dropdowns, you don't query the API again (only if an hour has passed).

OF course you have many options open to you - you could store the data in a session or a DB. The DB option may be best as it would mean just one trip to the API for the entire cohort for a period of an hour. Just a thought.

With regard to the list of currencies, you could have an array of the ones you want and match them up against the DB/Session/JSON held ones and display that way.

The JS logic would be the same as posted.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.