One of my pages has a big table that displays info from a database but the data runs down the page so if i were to view data at the bottom i would have to scroll down then I wouldn't be able to see the titles of the data from the top of the page. So i put the table into a scroll box. My problem is that the data is so spread apart in the scroll box. I have no idea why. Here is a copy of my code.

<div style="overflow:auto; height:400px; width:1250px">
<table cellpadding="0" cellspacing="0" style="width:50px;">
<?php
echo "<table border='1'>";
echo "<tr>"; 
echo "<td>" .$row['School'] . "</td>";
echo "<td>" .$row['Teacher'] . "</td>";
if(!strcmp($row['dtFirstContactSt'], '0000-00-00')) {
echo "<td>" . "No Date </td>";
} else {
echo "<td>" .$row['dtFirstContactSt']. "</td>";
}
if(!strcmp($row['dtDevelopmentSt'], '0000-00-00')) {
echo "<td>" . "No Date </td>";
} else {
echo "<td>" .$row['dtDevelopmentSt']. "</td>";
}
if(!strcmp($row['dtDevelopmentEnd'], '0000-00-00')) {
echo "<td>" . "No Date </td>";
} else {
echo "<td>" .$row['dtDevelopmentEnd']. "</td>";
};
if(!strcmp($row['dtPricingSt'], '0000-00-00')) {
echo "<td>" . "No Date </td>";
} else {
echo "<td>" .$row['dtPricingSt']. "</td>";
}
if(!strcmp($row['dtPricingEnd'], '0000-00-00')) {
echo "<td>" . "No Date </td>";
} else {
echo "<td>" .$row['dtPricingEnd']. "</td>";
}
if(!strcmp($row['dtMarketingSt'], '0000-00-00')) {
echo "<td>" . "No Date </td>";
} else {
echo "<td>" .$row['dtMarketingSt']. "</td>";
}
echo "<td>" .$row['PriceBasedOn']. "</td>";
echo "<td>" .$row['TripAssignedTo']. "</td>"; 
 ?>
<td><input type="checkbox" name="TripMade" value="Yes" <?= $checkbox ?>></td>
<td><textarea name="Notes" rows="1" cols="10"><?php echo $row["Notes"]?></textarea> </td>
<?php
echo "<td>" . "<a href=Edit_Form.php?UniqueIdentifier=$row[UniqueIdentifier]> Edit </a></td>";
echo "</tr>";
}
echo "</table>";
echo "</div>";

Recommended Answers

All 4 Replies

Are your table/div echo commands within a while statement?

have you considered using pagination instead?

for web design we must choose table less design concept for it. by this we can reduce our website loading time.

Wow, the div is set really wide - have you tried to reduce the size for the div? The table could be expanding to fill that space.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.