<?php session_start();  ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>CoolDrivePass : Emissions Calculator</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/JavaScript">
</script>

</head>

<?php
/* Connection to MySQL Database*/
	  $host="server358.mysite4now.com";
      $user="cooladmin";
      $password="chillme";
	  $database="emissions";
	  //Connection
	  $cxn = mysqli_connect($host,$user,$password,$database);
	 
	 
	  $estimate_query="SELECT liters_capacity, emission_kg_per_km,litre_per_100km
						FROM emission_estimates
						ORDER BY liters_capacity";

    	 $estimate_result = mysqli_query($cxn,$estimate_query);
	 
?>


<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('/images/buttons/buttons_color_02.gif','/images/buttons/buttons_color_03.gif','/images/buttons/buttons_color_04.gif','/images/buttons/buttons_color_05.gif')">

<div align="center">
  
  <table id="Table_02" width="674" border="0" cellpadding="0" cellspacing="0">

    <tr>

      <td align="right" valign="top"><div align="right" class="fixtable" >
        <table width="99%" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td width="64%" align="left" valign="bottom">
			  
			  <h3>Estimate your Emissions:</h3>
			  
			  </td>
            </tr>
            <tr valign="bottom">
              <td colspan="2" align="left" valign="top">
		      
                <form name="estimateform" action="../offsetters_cool/backup_result.php" method="POST" onSubmit="return require_Sel1AndSel2AndSel3()">
                  <table width="600" border="0">
                    <tr>
                      <td width="150">Engine Size: </td>
                      <td width="440">
					  <?php echo "<select name='estimates_sel'>";
										while($estimates = mysqli_fetch_array($estimate_result)) {
										echo "<option value='$estimates[emission_kg_per_km]'>$estimates[liters_capacity]</option>";
     									}			
										echo "</select>";
					  ?>
					  
					  </td>
                    </tr>
                    <tr>
                      <td>KM/Year:</td>
                      <td><select name="kmselect">
                          <option value="3000">3,000</option>
                          <option value="5000">5,000</option>
                          <option value="10000">10,000</option>
                          <option value="12000">12,000</option>
                          <option value="16000">16,000</option>
                          <option value="20000" selected>20,000</option>
                          <option value="24000">24,000</option>
                          <option value="32000">32,000</option>
                          <option value="40000">40,000</option>
                          <option value="45000">45,000</option>
                          <option value="50000">50,000</option>
                          <option value="60000">60,000</option>
                          <option value="80000">80,000</option>
                          <option value="100000">100,000</option>
                          <option value="110000">110,000</option>
                          <option value="120000">120,000</option>
                          <option value="140000">140,000</option>
                          <option value="160000">160,000</option>
                          </select>
                      <span style="font-size: 10px; font-style: italic;">an average driver, drives 20,000 Km per year.</span> </td>
                  </tr>
                  </table>
				  
				  <table width="600" border="0">
				  	<tr>
						<td width="150">How many years would you like to offset your emissions for?</td>
						
						<td width="440" valign="bottom">
							<select name="xyears">
							<option value="1">1 Year</option>
							<option value="2">2 Years</option>
							<option value="3">3 Years</option>
							<option value="4">4 Years</option>
							<option value="5">5 Years</option>	
					  </select>					  </td>
					</tr>
				  </table>
                  <br>
                  <input type="Submit" name="submitBttn" value="Calculate Emissions">
                </form></td>
			    
            </tr>
            <tr valign="bottom">
              <td colspan="3" align="left"><br>
          </td>
            </tr>
          </table>
      </div></td>
      
    </tr>
    
  </table>
  
</div>
</body>
</html>