Multiple Prints in a Loop<

I'm trying to use a for loop to load a table with some forms, two of which (selects) are quite long, so I'm trying to make these into functions. Here is a example of what I'm trying to do:

<html><head><title>Title</title></head</body>
<body>

<table>
<?
for($i=0;$i<5;$i++) {
print HERE<<<
<tr><td>First column</td>
<td>Second column</td>
HERE;
fillSelect();
fillSelect();
print HERE<<<
<td>Fifth column</td>
<td>Sixth column</td>
HERE;
}

function fillSelect() {
print HERE<<<
<td>
<select>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
</select>
</td>
HERE;
}
?>
</table>

</body>
</html>


The select is actually much longer, but I don't think it is the problem. I seems if I have more than 1 print statement in the loop it always gives me an error on the first line of the new print statement. Thanks.print HERE<<<
should be
print <<<HEREThe post was a typo, its actually correct in my code. Here is the actual code:


<html>
<body><title>NASCAR Week 1 Table</title></body>
<body>

<table border="1">
<tr><th colspan="7" align="center">NASCAR Week 1 Stats Table</td></tr>
<tr><th>Driver Index</th>
<th>Qualify</th>
<th>Finish</th>
<th>Total Points</th></tr>

<?
$driverIndex = 0;
for($i=0;$i<5;$i++) {
$driverIndex++;
print <<<HERE
<form id="driver$driverIndex">
<tr><td align="center">$driverIndex</td>
HERE;
raceResults();
raceResults();
//print "<td><input type='text' maxlength='3' size='5' id='points$driverIndex'></input></td>";
//print "</tr>";
}
?>

<?
function raceResults() {
print <<<HERE
<td>
<select id="finish">
<option value="0">Non-Qualifier</option>
<option value="1">1st</option>
<option value="2">2nd</option>
<option value="3">3rd</option>
<option value="4">4th</option>
<option value="5">5th</option>
<option value="6">6th</option>
</select>
</td>
HERE;
}

?>

</body>
</html>


As you can see I tried a simple "print" statment instead of a "print <<<HERE" following the second function and even that wouldn't work.Another piece of code miraculously fixes itself! I wish this would happen more often. Must have been something stupid. Thanks for the help.
 
Back
Top