By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,998 Members | 2,871 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,998 IT Pros & Developers. It's quick & easy.

html width not working

tolkienarda
100+
P: 316
hi all
i am printing out a bunch of html code with a php script and i am not sure if my html syntax or my php syntax, everything works and displays the way i want but the width tags for the text inputs don't work, anyway here is the php code that prints the html
[PHP]
$result = mysql_query("SELECT * FROM costs");
while ($row = mysql_fetch_row($result))
{
$final = $row[2] + $row[3];
$savings = $row[5] - $final;
echo '<tr>';
echo '<form action="process.php" method="post">', "\n";
echo "<input type='hidden' name='id' value='$row[0]'>","\n";

echo '<td align="center" bgcolor="#dbb47b">', $row[1], "</td>\n";
echo '<td bgcolor="#f2e1cd"> <input type="text" name="quan" width="10" value="1"></td>', "\n";
echo '<td align="center" bgcolor="#dbb47b">$', $row[2], "</td>\n";
echo '<td align="center" bgcolor="#f2e1cd">$', $row[3], "</td>\n";
echo '<td align="center" bgcolor="#dbb47b">$', $final, "</td>\n";
echo '<td align="center" bgcolor="#f2e1cd">$', $row[5], "</td>\n";
echo '<td align="center" bgcolor="#dbb47b">$', $savings, "</td>\n";
echo "<td bgcolor='#f2e1cd'><input type='submit' value='Calculate'></td>\n";

echo "</form>\n";
echo '</tr>';
}
[/PHP]

just for ease below is the html that is printed, this is coppied from the Firefox DOM inspector

Expand|Select|Wrap|Line Numbers
  1.   <tr><form action="process.php" method="post">
  2. <input type='hidden' name='id' value='2'>
  3. <td align="center" bgcolor="#dbb47b">Letter 1oz</td>
  4. <td bgcolor="#f2e1cd"> <input type="text" name="quan" width="10" value="1"></td>
  5. <td align="center" bgcolor="#dbb47b">$0.312</td>
  6. <td align="center" bgcolor="#f2e1cd">$0.078</td>
  7. <td align="center" bgcolor="#dbb47b">$0.39</td>
  8.  
  9. <td align="center" bgcolor="#f2e1cd">$0.41</td>
  10. <td align="center" bgcolor="#dbb47b">$0.02</td>
  11. <td bgcolor='#f2e1cd'><input type='submit' value='Calculate'></td>
  12. </form>
  13. </tr><tr><form action="process.php" method="post">
  14. <input type='hidden' name='id' value='3'>
  15. <td align="center" bgcolor="#dbb47b">Letter 2oz</td>
  16. <td bgcolor="#f2e1cd"> <input type="text" name="quan" width="10" value="1"></td>
  17. <td align="center" bgcolor="#dbb47b">$0.437</td>
  18. <td align="center" bgcolor="#f2e1cd">$0.078</td>
  19. <td align="center" bgcolor="#dbb47b">$0.515</td>
  20.  
  21. <td align="center" bgcolor="#f2e1cd">$0.58</td>
  22. <td align="center" bgcolor="#dbb47b">$0.065</td>
  23. <td bgcolor='#f2e1cd'><input type='submit' value='Calculate'></td>
  24. </form>
  25. </tr>
  26.  
and above all of the php code and fancy stuff is some simple html that starts the table off with some table colom titles here is the code for that

Expand|Select|Wrap|Line Numbers
  1.          <table align="center">
  2.     <tr align="center">
  3.         <td align="center" bgcolor="#dbb47b">Product</td>
  4.         <td align="center" bgcolor="#f2e1cd" width="75">Quantity</td>
  5.         <td align="center" bgcolor="#dbb47b">Postage &amp; <br> Handeling</td>
  6.         <td align="center" bgcolor="#f2e1cd">Postage <br> Application</td>
  7.  
  8.         <td align="center" bgcolor="#dbb47b">Final <br> Cost</td>
  9.         <td align="center" bgcolor="#f2e1cd">1st CL<br>Postal<br>Price</td>
  10.         <td align="center" bgcolor='#dbb47b'>Savings <br> Bottom <br> Line</td>
  11.  
  12.         <td>&nbsp; </td>
  13.     </tr>
  14.  
Note: this is the same table and is actualy above all that other stuff

if you would like to see the live version of this here is a link
http://www.ambimail.com/interactive_quote.php

thanks

eric
May 25 '07 #1
Share this Question
Share on Google+
4 Replies


pbmods
Expert 5K+
P: 5,821
Try using style="width:10em;" or style="width:10px;" instead of width="10".
May 25 '07 #2

tolkienarda
100+
P: 316
hmm that didn't seem to work and i am starting to wonder if the problem is elsewhere in my html code because no width attributes seem to work, that is i have tried to resize the <td>'s to force the size of the inputs down but that didn't work either.

eric
May 25 '07 #3

tolkienarda
100+
P: 316
wait ignore that last staement my stupidty is boundless i frogot to re upload the file after i made that change
thanks a million for the advice

eric
May 25 '07 #4

pbmods
Expert 5K+
P: 5,821
Did I ever tell you about the time when I downloaded a backup copy of the site we were working on, synced all the changes (this was before we had version control on our server), uploaded the new version and deleted the backup copy... and then found out that I had actually deleted the synced copy and re-uploaded the original!

If not, I just did. A month later, it's a miracle that pbmods still has a job!

Glad to hear that you got your issue hammered out. Keep 'em coming!
May 25 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.