0

I have the following code which formats a table on a webpage like this:

http://thepoolscene.com/rooms-new/

echo "<table border='1'>
<tr>
<th>Room Name</th>
<th>Address</th>
<th>Phone</th>
<th>Map</th>
</tr>";

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td font color=red>" . $row['NameofLocation'] . "</td>";
  echo "<td>" . $row['Address'] . ", " . $row['City'] . "  " . $row['Province'] . "</td>";
  echo "<td>" . $row['Phone'] . "</td>";
  echo "<td>" . "<a href='http://maps.google.com/maps?q=" . $row['Address'] . "+" . $row['City'] . "+" . $row['Province'] . "&hl=en'target=“_blank” >Map</a></font></td></tr>" . "</td>";
  echo "</tr>";
  }
echo "</table>";

I would like to format the table with some color and space out the columns a little more evenly. Is there a way to automate the width of each column? Specifically, it is the phone number and Map field which will remain constant.

1
  • 1
    you can use CSS for this Commented Dec 15, 2011 at 1:32

1 Answer 1

1

Maybe this will help you

<th style='width:50%; color:red;'>Room Name</th>
<th style='width:50%; color:red;'>Address</th>
<th style='width:80px; color:red;'>Phone</th>
<th style='width:20px; color:red;'>Map</th>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.