HTML validation; old code completely screwed the <td><tr> closure on completion of foreach loop