Hi,
Is there a set way to use forms and tables tags together so that the table will be good on all browsers?
At the moment my table looks fine on Mozilla. However with IE each time I add a row another row is added on top of the table. This means for three row of good data I have three blank rows followed by those three good rows. I’ve read that it’s often good to keep forms tags out of tables as much as possible, but this isn’t an option for me. My code is below. Tested on IE 7 and Mozilla 5.
I was thinking this might be as simple as having all form tags between a </td> and a </tr> tag or something similar. I tried to add a picture to this post but failed, if you think it would help explain the problem please let me know how to add one as I couldn’t get the attachment option to work.
Thanks,
T
[CODE]
echo ‘<table>
<colgroup>
<col id=”arrCol1″><col id=”arrCol2″><col id=”arrCol3″><col id=”arrCol4″><col id=”arrCol5″><col id=”arrCol6″><col id=”arrCol7″>
</colgroup>’;
$bgColour = ‘L’;
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
if($bgColour == ‘L’){
echo ‘<tr class=”rowNormalL”>’;
}
else{
echo ‘<tr class=”rowNormalD”>’;
}
echo'<td></td><td></td><td>Arrival Date</td><td>Arrival Time</td><td>Flat</td><td>Depart Date</td><td>Depart Time</td></tr>’;
if($bgColour == ‘L’){
echo ‘<tr class=”rowArrivalsL”>’;
}
else{
echo ‘<tr class=”rowArrivalsD”>’;
}
echo'<form method=”post” action=”aedBooking.php”>
<input type=”hidden” name=”bookID” value=”‘.$row[‘bookID’].'”>
<td><input type=”submit” name=”addEditDel” value=”Del”></td>
<td><input type=”submit” name=”addEditDel” value=”Edit”></td>
</form><td>’;
echo ud_DateSwitch_UK_SQL($row[‘Arrival_Date’]).”</td><td>”.$row[‘Arrival_Time’].”</td><td>”.$row[‘Flat’].”</td><td>”.ud_DateSwitch_UK_SQL($row[‘Depart_Date’]).”</td><td>”.$row[‘Depart_Time’].”</td></tr>”;
if($bgColour == ‘L’){
echo ‘<tr class=”rowNormalL”>’;
}
else{
echo ‘<tr class=”rowNormalD”>’;
}
echo ‘<td></td><td></td><td>Name</td><td>Email</td><td>Fee</td><td>Deposit</td><td>Dep Returned</td></tr>’;
if($bgColour == ‘L’){
echo ‘<tr class=”rowArrivalsL”>’;
$bgColour = ‘D’;
}
else{
echo ‘<tr class=”rowArrivalsD”>’;
$bgColour = ‘L’;
}
echo'<td></td><td><form method=”post” action=”addEditBookDB.php”>
<input type=”hidden” name=”bookID” value=”‘.$row[‘bookID’].'”>
<input type=”submit” name=”addEdit” value=”Dep”></form></td><td>’;
echo $row[‘Name’].”</td><td>”.$row[‘Email’].”</td><td>”.$row[‘Fee_Amount’].”</td><td>”.$row[‘Deposit’].”</td><td>”.$row[‘Dep_Returned’].”</td></tr>”;
}
echo ‘</table>’;