Cool, glad you figgered it out - sorry about the modifier.
May I make another suggestion?
The form of coding your doing is VERY old schol PHP - that came about when PHP was really just an HTML helper as opposed to a full-fledged language. Adding little chunks like that in the middle was about the best it could do.
The problem is that in the file you've shown, the very first <H of that file will go out before PHP gets a shot to do anything and POW you're committed headers, that page etc. I never, ever code that way because it's too limiting.
Here is how it looks as a pure PHP rather than an HTML with a little PHP:
<?php
$main = <<<HTML
<html>
<head>
<script src="flapper.js"></script>
<style type="text/css">
body {
color: black;
background-color: white; }
table {
color: black;
background-color: #226185;
}
.tanks {
padding-left: 18em;
}
.site {
position: absolute;
left: 1em;
}
.results {
position: absolute;
left: 1em;
top: 20em;
}
</style>
</head>
<body>
<form name="form1" action="<?php echo($_SERVER['PHP_SELF']);?>" method="POST" />
<div id="site" class="site">
<table>
<tr><th colspan="2">Site Information</th></tr>
<tr><td>Site Number</td><td><input type="text" name="site_no" /></td></tr>
<tr><td>Name</td><td><input type="text" name="name_site" /></td></tr>
<tr><td>Address</td><td><input type="text" name="site_address" /></td></tr>
<tr><td>City</td><td><input type="text" name="site_city" /></td></tr>
<tr><td>Inspection Date</td><td><input type="text" name="inspection_date" /></td></tr>
<tr><td>Gemstar Inspector</td><td><input type="text" name="gemstar_inspector" /></td></tr>
<tr><td>JD2 Inspector</td><td><input type="text" name="jd2_inspector" /></td></tr>
<tr><td><input type="button" value="Add Tank" onclick="addDirectTank();" /></td><td><input type="submit" value="Submit" /></td></tr>
</table>
</div>
<div id="tanks" class="tanks"></div>
<div id="numtanks"></div>
</form>
<div style="display: none">
<div id="templateDirect">
<table>
<tr><th colspan="2">Tank Information {i}</th><th colspan="2">Calculations</th></tr>
<tr><td>Tank # Per V-R</td><td><input type="text" name="{i}tank_no" /></td><td>95% Gallons</td><td><input type="text" name="{i}gal_95" disabled="disabled" /></td></tr>
<tr><td>Product</td><td><input type="text" name="{i}product" /></td><td>Inches to tank top (A)</td><td><input type="text" name="{i}in_tank_top" disabled="disabled" /></td></tr>
<tr><td>Manufacturer</td><td><input type="text" name="{i}manufacturer" /></td><td>Z95</td><td><input type="text" name="{i}z_95" disabled="disabled" /></td></tr>
<tr><td>Tank type/model</td><td><input type="text" name="{i}tank_type" /></td><td>Fill to flapper</td><td><input type="text" name="{i}top_to_flapper" disabled="disabled" /></td></tr>
<tr><td>Date of install</td><td><input type="text" name="{i}date_install" /></td><td>Difference (C Actual - C 95)</td><td><input type="text" name="{i}difference" disabled="disabled" /></td></tr>
<tr><td>Flapper Model</td><td><input type="text" name="{i}flapper_model" /></td><td>Inches at C95 Actual</td><td><input type="text" name="{i}inches_C95_actual" disabled="disabled" /></td></tr>
<tr><td>Flapper installed on manway?</td><td><input type="text" name="{i}flapper_installed_manway" /></td><td>Flapper is set at</td><td><input type="text" name="{i}flapper_set_at" disabled="disabled" /></td></tr>
<tr><td>Type of fill</td><td><input type="text" name="{i}type_fill" /></td><th colspan="2">Conclusion</th></tr>
<tr><td>Float orientation</td><td><input type="text" name="{i}float_orientation" /></td><th colspan="2"><input type="text" name="{i}conclusion" /></th></tr>
<tr><td>Cut Orientation</td><td><input type="text" name="{i}cut_orientation" /></td><th colspan="2" rowspan="11"><img src="directsmall.jpg" /></th></tr>
<tr><td>Jack Screws</td><td><input type="text" name="{i}jack_screws" /></td></tr>
<tr><td>Size in gallons</td><td><input onKeyUp="calcValues({i});" type="text" name="{i}size_gallons" /></td></tr>
<tr><td>Tank diameter (Y)</td><td><input onKeyUp="calcValues({i});" type="text" name="{i}tank_diameter" /></td></tr>
<tr><td>Top of drop tube to tank bottom(inches) (B)</td><td><input onKeyUp="calcValues({i});" type="text" name="{i}fill_to_bottom" /></td></tr>
<tr><td>Inches at 95% total volume (X95)</td><td><input onKeyUp="calcValues({i});" type="text" name="{i}inches_95" /></td></tr>
<tr><td>Top of fill to flapper (inches)</td><td><input onKeyUp="calcValues({i});" type="text" name="{i}fill_to_flapper" /></td></tr>
<tr><td>Gallons at C95 Actual</td><td><input onKeyUp="calcValues({i});" type="text" name="{i}gallons_95" /></td></tr>
<tr><td>DT Height above tank bottom</td><td><input type="text" name="{i}dt_height" /></td></tr>
</table>
<br />
</div>
<div id="templateRemote">
<table>
<tr><th colspan="2">Tank Information</th><th colspan="2">Calculations</th></tr>
<tr><td>Tank # Per V-R</td><td><input type="text" name="{i}tank_no" /></td><td>95% Gallons</td><td><input type="text" name="{i}gal_95" disabled="disabled" /></td></tr>
<tr><td>Product</td><td><input type="text" name="{i}product" /></td><td>Inches to tank top (A)</td><td><input type="text" name="{i}in_tank_top" disabled="disabled" /></td></tr>
<tr><td>Manufacturer</td><td><input type="text" name="{i}manufacturer" /></td><td>Z95</td><td><input type="text" name="{i}z_95" disabled="disabled" /></td></tr>
<tr><td>Tank type/model</td><td><input type="text" name="{i}tank_type" /></td><td>Fill to flapper</td><td><input type="text" name="{i}top_to_flapper" disabled="disabled" /></td></tr>
<tr><td>Date of install</td><td><input type="text" name="{i}date_install" /></td><td>Difference (C Actual - C 95)</td><td><input type="text" name="{i}difference" disabled="disabled" /></td></tr>
<tr><td>Flapper Model</td><td><input type="text" name="{i}flapper_model" /></td><td>Inches at C95 Actual</td><td><input type="text" name="{i}inches_C95_actual" disabled="disabled" /></td></tr>
<tr><td>Flapper installed on manway?</td><td><input type="text" name="{i}flapper_installed_manway" /></td><td>Flapper is set at</td><td><input type="text" name="{i}flapper_set_at" disabled="disabled" /></td></tr>
<tr><td>Type of fill</td><td><input type="text" name="{i}type_fill" /></td><th colspan="2">Conclusion</th></tr>
<tr><td>Float orientation</td><td><input type="text" name="{i}float_orientation" /></td><th colspan="2"><input type="text" name="{i}conclusion" /></th></tr>
<tr><td>Cut Orientation</td><td><input type="text" name="{i}cut_orientation" /></td><th colspan="2" rowspan="11"><img src="remotesmall.jpg" /></th></tr>
<tr><td>Jack Screws</td><td><input type="text" name="{i}jack_screws" /></td></tr>
<tr><td>Size in gallons</td><td><input onKeyUp="calcValues({i});" type="text" name="{i}size_gallons" /></td></tr>
<tr><td>Tank diameter (Y)</td><td><input onKeyUp="calcValues({i});" type="text" name="{i}tank_diameter" /></td></tr>
<tr><td>Top of drop tube to tank bottom(inches) (B)</td><td><input onKeyUp="calcValues({i});" type="text" name="{i}fill_to_bottom" /></td></tr>
<tr><td>Inches at 95% total volume (X95)</td><td><input onKeyUp="calcValues({i});" type="text" name="{i}inches_95" /></td></tr>
<tr><td>Top of fill to flapper (inches)</td><td><input onKeyUp="calcValues({i});" type="text" name="{i}fill_to_flapper" /></td></tr>
<tr><td>Gallons at C95 Actual</td><td><input onKeyUp="calcValues({i});" type="text" name="{i}gallons_95" /></td></tr>
<tr><td><b>Remotes only:</b> Inches to bottom of tee (E)</td><td><input type="text" name="{i}inches_bottom_tee" /></td></tr>
<tr><td><b>Remotes only:</b> Riser Height Below Tee to TT (min = 13")</td><td><input type="text" name="{i}riser_height_below_tee" /></td></tr>
<tr><td>DT Height above tank bottom</td><td><input type="text" name="{i}dt_height" /></td></tr>
</table>
<br />
</div>
</div>
</body>
</html>
HTML;
if(isset($_POST['site_no']))
{
echo("<pre>\n<div id=\"results\" class=\"results\">\n");
print_r($_POST);
echo("</div>\n</pre>\n");
}
echo $main;
?>
Again, you may ask why - well, with this form, my output is explicit, rather than implied - and it's also at the exact moment of my choosing rather than when PHP runs across a character and pukes it out. Note that a file like this MUST NOT have any carriage returns on either side of the <?php ?> or you'll defeat the whole purpose.
My standard MO is to do all my work (whatever it is) - and create an array that contains everything that will be going back out and then dump it at the last minute. This gives me the opportunity, at any time during processing, to completely change course (ie., send back a 404, change the output utterly, redirect, you name it) which I find in dynamic sites as very helpful.
Note that the TEXTHERE operator ( <<< ) will dereference variables, so you could put all kinds of vars right in that block. eg:
<?php
$theDate = date('Y-m-d H:i:s', time());
$aString = 'Hello World';
$buff = <<<SOMETEXT
The date is $theDate and I'd like to say "$aString."
SOMETEXT;
?>
If you get used to this form, you'll find LOTS of wonderfulness in how you can code efficiently.
/p