Dollars to Euros Solution

  Convert Dollars to Euros!   Convert Dollars to Euros!             Dollars:         Euros:           Rate: 		1.1 		1.2 		1.3 		1.4 		<option value="1.5">1.5 		<option value="1.6">1.6 		<option value="1.7">1.7 		<option value="Other">Other  		If "Other"<INPUT TYPE="TEXT" NAME="customrate"/> <BR>   </LABEL>    <INPUT TYPE="Submit" VALUE="Convert!" />    </FORM>');

if ($dollars ===  && $euros === ) { echo	"Please input dollars or euros!<BR>"; } elseif ($dollars !=  && $euros != ) { echo "Which way do you mean to go!"; } elseif ($euros === '') { if($_GET['rate'] == 'Other'){ //we need to use our manually entered exchange rate echo $dollars. " dollars are worth ". convertD2E($dollars,$_GET['customrate']). " euros."; }else{ echo $dollars. " dollars are worth ". convertD2E($dollars,$_GET['rate']). " euros."; } } else { // $dollars is unset if($_GET['rate'] == 'Other'){ echo $euros. " euros are worth ". convertE2D($euros,$_GET['customrate']). " dollars."; }else{ echo $euros. " euros are worth ". convertE2D($euros,$_GET['rate']). " dollars."; } }

function convertD2E($dollars, $rate){ return $dollars*$rate; }

function convertE2D($euros, $rate){ return $euros*(1/$rate); } ?> </BODY> </HTML>