Currrency Converter in PHP

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


<html>
 <body bgcolor = "ffffff">
  <center>
  <p></p><p></p><p></p>
	<form method= "post">
	Peso Value:
		<input name = "currency" type = "text"><br><p></p>
	Currency:
		<Select name="place" ><br><p></p>
		<option>Argentine Peso</option>
		<option>Bahamian Dollar</option>
		<option>Brazilian Real </option>
		<option>Canadian Dollar</option>
		<option>Colombian Peso</option>
		</select><br><p>
		<input type="submit" value="Convert"/><br><p></p><p></p><p></p><p></p>

		<?php 

			$currency=$_POST['currency'];
			$place = $_POST['place'];
			$ARS= 0.06586;
			$BSD=0.02129;
			$BRL=0.03794;
			$CAD=0.02286;
			$COP=44.56140;

					switch ($place){
						case "Argentine Peso":
							$a=($currency*$ARS);
							echo "<p>Php $currency is equivalent to $a ARS in Argentina</p>";
						break;
						case "Bahamian Dollar":
							$b=($currency*$BSD);
							echo "<p>Php $currency is equivalent to $b BSD in Bahama</p>";
						break;
						case "Brazilian Real":
							$c=($currency*$BRL);
							echo "<p>Php $currency is equivalent to $c BRL in Brazil</p>";
						break;
						case "Canadian Dollar":
							$d=($currency*$CAD);
							echo "<p>Php $currency is equivalent to $d CAD in Canada</p>";
						break;
						case "Colombian Peso":
							$e=($currency*$COP);
							echo "<p>Php $currency is equivalent to $e COP in Colombia</p>";
						}
//REFERENCE: http://www.exchange-rates.org/currentRates/PHP
		?>

		</form>
    </center>
  </body>
</html>


(Visited 18 times, 1 visits today)
Download File Counter Using PHP
Calorie Calculator Using PHP

Comments

comments

Leave a Reply

Your email address will not be published. Required fields are marked *