/    Sign up×
Community /Pin to ProfileBookmark

Table Form IE Problems

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>’;

[/CODE]

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@felgallJun 02.2009 — Your table structure is incorrect.

You can either have a form wrapped around a <table> or inside a <td> but not wrapped around a part of a table.
Copy linkTweet thisAlerts:
@Tom3CauthorJun 03.2009 — Thanks for that. Changed my code around so that rule stays true and hey presto!!!

Cheers,

T
×

Success!

Help @Tom3C spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...