<?php session_start(); 

echo '<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Confirmation Page</title>
</head>
<body>';
       $company = Offsetters;
	   $name = $_POST['name'];
	   $transaction = $_POST['transaction'];
	   $agent = $_POST['agent'];
	   $emission = $_SESSION['emission'];
	   $distance = $_SESSION['distance'];
	   $cost = $_SESSION['cost'];
       /* Connection to MySQL Database*/
	  $host="mysql103.mysite4now.com";
	  $user="external";
	  $password="ocns";
      $database="ocns_calculator";
      $table = "offsets";
	  
	  //Connection
	  $cxn = mysqli_connect($host,$user,$password,$database)
             or die ("couldn't connect to server");

            
       echo '<p>Your entry for ' .$_POST['name'] . ' was successfully saved. </p>';
       
	   $query="INSERT INTO $table (name,transaction,agent,emission,distance,cost,company) VALUES 
	           ('$name','$transaction','$agent','$emission','$distance','$cost','$company')";
	   
	   $result = mysqli_query($cxn,$query)
             or die ("Couldn't execute query.");
       echo "<h4>New Data added to database</h4>";
?>
	   <a href="calc.php"><br/>
New calculation

       </a>
</body>
</html>
