...

View Full Version : PHP Coding, Add Rows to HTML Table based on $Difference variable



aavgeek
09-17-2009, 02:47 AM
Hello,

Working a project where I'm generating a participant roster for an event registration system. The roster shows the name of the person and a line in the column to the right for them to sign in. The system currently counts how many people are registered, and compares that to the number of seats. This is the $Difference variable. This works. What I want to do, is have the system auto add table rows with lines for write-ins. The number of rows with lines should be the same number of rows as the $Difference variable. So, if the $Difference for one event was 4, the system would add 4 rows. If it was 2, it would add 2 rows.

How do I code this to make it work? Should be fairly easy, but I'm not getting it.

Thanks.

Here's my code:

<tr>
<td>_____________________________________</td>
<td>&nbsp;</td>
<td>_______________________________</td>
</tr>

<?php $Difference = $row_Events['maxseats'] - $row_Events['count_jid_1'];
for ($i=0; $i < $Difference; $i++);
$txt = "<tr>
<td>_____________________________________</td>
<td>&nbsp;</td>
<td>_______________________________</td>
".$i.\"</tr>";
echo ($txt);
?>
</table>

mlseim
09-17-2009, 03:02 AM
<tr>
<td>_____________________________________</td>
<td>&nbsp;</td>
<td>_______________________________</td>
</tr>

<?php $Difference = $row_Events['maxseats'] - $row_Events['count_jid_1'];
for ($i=0; $i < $Difference; $i++){
echo"
<tr>
<td>$i) </td>
<td>_____________________________________</td>
<td>&nbsp;</td>
<td>_______________________________</td>
</tr>
";
}
?>
</table>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum