Here is a section of code from one of my pages that should help you out. I'm not sure I can explain it all, but I know it works.
Code:
if ($_REQUEST['do'] == 'Calculate with Own Data')
{
$eng=$_POST["engine"];
$overbore=$_POST["overbore"];
$conn=mysql_connect($dbhost,$dbuser,$dbpass) or die
('Error connecting to mysql');
mysql_select_db($dbname);
$result = mysql_query("SELECT * FROM cr_calc_data WHERE engine = $eng");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$row = mysql_fetch_row($result);
mysql_close($conn);
$engine=$row[8];
$bore = $row[1]+$overbore;
$navbits = array();
$navbits[$parent] = 'CR Calculator - Default Values';
$navbits = construct_navbits($navbits); eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('CRCALC2') . '");');
}
The parts to look at are the POST command and then the EVAL command at the very end where it calls the template. I'll try to help you out where I can, but I'm only a novice coder. It took many tries before I got it all to work correctly.