如何在数据提交后通过MySQL显示表中的数据?

I have users filling out two forms. After they submit their information, the next page is supposed to display that same information in a table. I managed to create the table, but the data inside the table looks really squished.

    $sql = "SELECT * FROM Profiles";
    $result = $conn->query($sql);

    if ($result->num_rows > 0) {
        echo "<table border='2' height='100'><tr><th>KSU_ID</th><th>First_Name</th><th>Last_Name</th>
                <th>Email</th><th>Day</th><th>Availability</th><th>Services</th></tr>";

        while($row = $result->fetch_assoc()) {

        echo "<tr><td>";
        echo $row['k'];
        echo "</td><td>";
        echo $row["f"];
        echo "</td><td>"; 
        echo $row["l"];
        echo "</td><td>"; 
        echo $row["e"];
        echo "</td><td>";   
        echo $row["day"];
        echo "</td><td>"; 
        echo $row["time"];
        echo "</td><td>";   
        echo $row["service"];
        echo "</td></tr>";  
        }
        echo "</table>";

I'm not sure what I'm doing incorrectly here. I've seen the information in the section done in a variety of ways and none of them worked for me. I do have the results accessing the sql database, but it's earlier on in the php. I didn't want to flood you all with my php code. If you want me to post it, I'll do so.

As an update, I figured it out. The information in the "row" area was incorrect. I put my variables and not the name of the column. That resulted in an table with many empty rows, creating the "squished" look I referred to. I'll try more work before posting again so I don't keep flooding the forums. Thanks for the help, anyway. It's always appreciated.

I am not sure to have understood your "squished" meaning.
If your data are correct, you probably need a css stylesheet, in order to define font size, row height and so on.

You have missed right curly brackets in if condition . in this way your code showing an error just need to add right curly brackets } after this line

echo "</table>";

Or else used below code..

Check below code. i have just changed the format to read and understand to easily. $sql = "SELECT * FROM Profiles"; $result = $conn->query($sql);

if ($result->num_rows > 0) {
    ?>
    <table border='2'>
        <tr>
            <th>KSU_ID</th>
            <th>First_Name</th>
            <th>Last_Name</th>
            <th>Email</th>
            <th>Day</th>
            <th>Availability</th>
            <th>Services</th>
        </tr>
        <?php 
        while($row = $result->fetch_assoc()) {
        ?>
        <tr>
            <td><?php echo $row['k']; ?></td>
            <td><?php echo $row['f']; ?></td>
            <td><?php echo $row['l']; ?></td>
            <td><?php echo $row['e']; ?></td>
            <td><?php echo $row['day']; ?></td>
            <td><?php echo $row['time']; ?></td>
            <td><?php echo $row['service']; ?></td>
        </tr>
        <?php
        }
        ?>
    </table>
<?php }?>