/ Published in: PHP
This took me a while to create so thought I would share. Can be used with <a href="http://www.textfixer.com/resources/country-dropdowns.php">HTML dropdown lists</a>.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function country_currency( $amount = 0 ) { $bc = ''; // Set this to your country $currency_before = ''; $currency_after = ''; if( $bc == 'GB' || $bc == 'IE' || $bc == 'CY' ) $currency_before = '£'; if( $bc == 'AT' || $bc == 'BE' || $bc == 'FI' || $bc == 'FR' || $bc == 'DE' || $bc == 'GR' || $bc == 'GP' || $bc == 'IT' || $bc == 'LU' || $bc == 'NL' || $bc == 'PT' || $bc == 'SI' || $bc == 'ES') $currency_before = '€'; if( $bc == 'BR' ) $currency_before = 'R$'; if( $bc == 'CN' || $bc == 'JP' ) $currency_before = '¥'; if( $bc == 'CR' ) $currency_before = '¢'; if( $bc == 'HR' ) $currency_after = ' kn'; if( $bc == 'CZ' ) $currency_after = ' kc'; if( $bc == 'DK' ) $currency_before = 'DKK '; if( $bc == 'EE' ) $currency_after = ' EEK'; if( $bc == 'HK' ) $currency_before = 'HK$'; if( $bc == 'HU' ) $currency_after = ' Ft'; if( $bc == 'IS' || $bc == 'SE' ) $currency_after = ' kr'; if( $bc == 'IN' ) $currency_before = 'Rs. '; if( $bc == 'ID' ) $currency_before = 'Rp. '; if( $bc == 'IL' ) $currency_after = ' NIS'; if( $bc == 'LV' ) $currency_before = 'Ls '; if( $bc == 'LT' ) $currency_after = ' Lt'; if( $bc == 'MY' ) $currency_before = 'RM'; if( $bc == 'MT' ) $currency_before = 'Lm'; if( $bc == 'NO' ) $currency_before = 'kr '; if( $bc == 'PH' ) $currency_before = 'PHP'; if( $bc == 'PL' ) $currency_after = ' z'; if( $bc == 'RO' ) $currency_after = ' lei'; if( $bc == 'RU' ) $currency_before = 'RUB'; if( $bc == 'SK' ) $currency_after = ' Sk'; if( $bc == 'ZA' ) $currency_before = 'R '; if( $bc == 'KR' ) $currency_before = 'W'; if( $bc == 'CH' ) $currency_before = 'SFr. '; if( $bc == 'SY' ) $currency_after = ' SYP'; if( $bc == 'TH' ) $currency_after = ' Bt'; if( $bc == 'TT' ) $currency_before = 'TT$'; if( $bc == 'TR' ) $currency_after = ' TL'; if( $bc == 'AE' ) $currency_before = 'Dhs. '; if( $bc == 'VE' ) $currency_before = 'Bs. '; if( $currency_before == '' && $currency_after == '' ) $currency_before = '$'; }