Currrency Converter in PHP

Submitted by: 
Language: 
Visitors have accessed this post 16458 times.

A currency converter that converts Philippine Peso into different currency. The values of each currency would change depending upon the current market value.

  1. <?php
  2.  
  3. $currency=$_POST['currency'];
  4. $place = $_POST['place'];
  5. $ARS= 0.06586;
  6. $BSD=0.02129;
  7. $BRL=0.03794;
  8. $CAD=0.02286;
  9. $COP=44.56140;
  10.  
  11. switch($place){
  12. case "Argentine Peso":
  13. $a=($currency*$ARS);
  14. echo "<p>Php $currency is equivalent
  15.  
  16. to $a ARS in Argentina</p>";
  17. break;
  18. case "Bahamian Dollar":
  19. $b=($currency*$BSD);
  20. echo "<p>Php $currency is equivalent
  21.  
  22. to $b BSD in Bahama</p>";
  23. break;
  24. case "Brazilian Real":
  25. $c=($currency*$BRL);
  26. echo "<p>Php $currency is equivalent
  27.  
  28. to $c BRL in Brazil</p>";
  29. break;
  30. case "Canadian Dollar":
  31. $d=($currency*$CAD);
  32. echo "<p>Php $currency is equivalent
  33.  
  34. to $d CAD in Canada</p>";
  35. break;
  36. case "Colombian Peso":
  37. $e=($currency*$COP);
  38. echo "<p>Php $currency is equivalent
  39.  
  40. to $e COP in Colombia</p>";
  41. }
  42. //REFERENCE: http://www.exchange-rates.org/currentRates/PHP
  43. ?>

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Comments

thanks..

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.