Dollars to Euros Solution

<HTML>
<HEAD>
  <TITLE>Convert Dollars to Euros!</TITLE>
</HEAD>
<BODY>
<H4>Convert Dollars to Euros!</H4>
<?php
$battingaverage = 0;
$dollars	= htmlentities($_GET["dollars"]);    // Get the data stored in the form's search element
$euros	= htmlentities($_GET["euros"]);    // Get the data stored in the form's search element
$self =	$_SERVER['PHP_SELF']; // This file itself will process the form.
//$rate = .5;
echo ('
    <FORM ACTION="'.$self.'"  METHOD="GET">
    <LABEL>
        Dollars: <INPUT TYPE="TEXT" NAME="dollars"/>
        Euros: <INPUT TYPE="TEXT" NAME="euros"/><br>
        <!-- To dollars:<input type="radio" value="dollars" name="direction"><br />
		To euros:<input type="radio" value="euros" name="direction"><br />' .
       ' --> Rate:<select name="rate">
		<option value="1.1">1.1</option>
		<option value="1.2">1.2</option>
		<option value="1.3">1.3</option>
		<option value="1.4">1.4</option>
		<option value="1.5">1.5</option>
		<option value="1.6">1.6</option>
		<option value="1.7">1.7</option>
		<option value="Other">Other</option></select>
		If "Other"<INPUT TYPE="TEXT" NAME="customrate"/><br><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>