473,320 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

problem in IE with aligning table

Hi all,

I have a problem with css table. The code below works fine with firefox but the problem is with Internet explorer.
This code actually fetches data from mysql database and display it in the form of table for which I have used CSS. In firefox the fetched are aligned properly but in Internet explorer, the width alignment is messed up.
Here is the code I am using

main.php
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <link href="main.css" rel="stylesheet" type="text/css" />
  4. </head>
  5. <body>
  6. <?php
  7. include("Con.php");
  8.  
  9. $query = "SELECT DEG1,DEG2 FROM lists WHERE Grp='$grp'";
  10. $result = mysql_query($query);
  11. $num = mysql_num_rows($result);
  12.  
  13. echo ("<table class=meal-table>");
  14. echo ("<tr>");
  15. echo ("<th scope=col>"."Food Desc"."</td>");
  16. echo ("<th scope=col>"."Enter Amount"."</td>");
  17. echo ("<th scope=col>"."Msre Desc"."</td>");
  18. echo ("</tr>");
  19. echo ("</table>");
  20.  
  21. while ($values = mysql_fetch_array($result))
  22. {
  23.     echo ("<form name='addmenu' action ='' method='POST'");
  24.     echo ("<table class=meal-table>");
  25.     echo ("<tr>");
  26.     echo ("<td>".$values['DEG1']."</td>");
  27.     echo ("<td>");
  28.        echo ("<input type='textbox' size='3' name='msreval'>");
  29.     echo ("</td>");
  30.     echo ("<td>".$values['DEG2']."</td>");
  31.     echo ("<td>");
  32.     echo ("<input type='submit' value='add' name='submit' size='3'>");
  33.     echo ("</td>");
  34.     echo ("</tr>");
  35.     echo ("</table>");
  36.     echo ("</form>");    
  37. }
  38. ?>
  39. </body>
  40. </html>
main.css
Expand|Select|Wrap|Line Numbers
  1. .meal-table
  2. {
  3.   padding: 0;
  4.   margin: 0;
  5.   border-collapse: collapse;
  6. }
  7. .meal-table th
  8. {
  9.   border: 1px solid #000;
  10.   padding: 0.5em;
  11.   text-align: left;
  12.   width:150px;
  13.   height:10px;
  14. }
  15. .meal-table td
  16. {
  17.   border: 1px solid #000;
  18.   padding: 0.5em;
  19.   text-align: left;
  20.   width:150px;
  21.   height:10px;
  22. }
Could anyone please help me to solve this problem

With regards
May 13 '08 #1
2 2019
harshmaul
490 Expert 256MB
Hi all,

I have a problem with css table. The code below works fine with firefox but the problem is with Internet explorer.
This code actually fetches data from mysql database and display it in the form of table for which I have used CSS. In firefox the fetched are aligned properly but in Internet explorer, the width alignment is messed up.
Here is the code I am using

main.php
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <link href="main.css" rel="stylesheet" type="text/css" />
  4. </head>
  5. <body>
  6. <?php
  7. include("Con.php");
  8.  
  9. $query = "SELECT DEG1,DEG2 FROM lists WHERE Grp='$grp'";
  10. $result = mysql_query($query);
  11. $num = mysql_num_rows($result);
  12.  
  13. echo ("<table class=meal-table>");
  14. echo ("<tr>");
  15. echo ("<th scope=col>"."Food Desc"."</td>");
  16. echo ("<th scope=col>"."Enter Amount"."</td>");
  17. echo ("<th scope=col>"."Msre Desc"."</td>");
  18. echo ("</tr>");
  19. echo ("</table>");
  20.  
  21. while ($values = mysql_fetch_array($result))
  22. {
  23.     echo ("<form name='addmenu' action ='' method='POST'");
  24.     echo ("<table class=meal-table>");
  25.     echo ("<tr>");
  26.     echo ("<td>".$values['DEG1']."</td>");
  27.     echo ("<td>");
  28.        echo ("<input type='textbox' size='3' name='msreval'>");
  29.     echo ("</td>");
  30.     echo ("<td>".$values['DEG2']."</td>");
  31.     echo ("<td>");
  32.     echo ("<input type='submit' value='add' name='submit' size='3'>");
  33.     echo ("</td>");
  34.     echo ("</tr>");
  35.     echo ("</table>");
  36.     echo ("</form>");    
  37. }
  38. ?>
  39. </body>
  40. </html>
main.css
Expand|Select|Wrap|Line Numbers
  1. .meal-table
  2. {
  3.   padding: 0;
  4.   margin: 0;
  5.   border-collapse: collapse;
  6. }
  7. .meal-table th
  8. {
  9.   border: 1px solid #000;
  10.   padding: 0.5em;
  11.   text-align: left;
  12.   width:150px;
  13.   height:10px;
  14. }
  15. .meal-table td
  16. {
  17.   border: 1px solid #000;
  18.   padding: 0.5em;
  19.   text-align: left;
  20.   width:150px;
  21.   height:10px;
  22. }
Could anyone please help me to solve this problem

With regards
I think this is a problem with how you are using PHP....

u need to print the <tr> elements using the echo.... all within the same root <table> element.....

Try this....
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <link href="main.css" rel="stylesheet" type="text/css" />
  4. </head>
  5. <body>
  6. <?php
  7. include("Con.php");
  8.  
  9. $query = "SELECT DEG1,DEG2 FROM lists WHERE Grp='$grp'";
  10. $result = mysql_query($query);
  11. $num = mysql_num_rows($result);
  12.  
  13. echo ("<table class=meal-table>");
  14. echo ("<tr>");
  15. echo ("<th scope=col>"."Food Desc"."</th>");
  16. echo ("<th scope=col>"."Enter Amount"."</th>");
  17. echo ("<th scope=col>"."Msre Desc"."</th>");
  18. echo ("<th scope=col>"."&nbsp;"."</th>");
  19. echo ("</tr>");
  20.  
  21. while ($values = mysql_fetch_array($result))
  22. {
  23.     echo ("<form name='addmenu' action ='' method='POST'");
  24.     echo ("<tr>");
  25.     echo ("<td>".$values['DEG1']."</td>");
  26.     echo ("<td>");
  27.        echo ("<input type='textbox' size='3' name='msreval'>");
  28.     echo ("</td>");
  29.     echo ("<td>".$values['DEG2']."</td>");
  30.     echo ("<td>");
  31.     echo ("<input type='submit' value='add' name='submit' size='3'>");
  32.     echo ("</td>");
  33.     echo ("</tr>");
  34.  
  35.     echo ("</form>");    
  36. }
  37.  
  38.     echo ("</table>");
  39. ?>
  40. </body>
  41. </html>
Also your table wasn't done properly... please examine the changes i made.... and if you don't understand the need for them ask ans we'll fill in the gaps.....

Dont Forget.... this was a PHP problem... in the sense you was using it incorrectly!!!

i hope that helped
May 13 '08 #2
Hi,

It helped me a lot. Thank you so much
May 13 '08 #3

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

Similar topics

2
by: Felipe Gasper | last post by:
I'm trying to make some "sub-cells" in an HTML table and to control their positioning and content presentation via CSS. In the table at the following URL: ...
9
by: Dustin | last post by:
Here's what I am trying to do: (Names represent CSS classes.) I want to create a photo gallery. I want the entire gallery to be surrounded by a box named PhotoGallery. I want a fluid placement...
102
by: Skybuck Flying | last post by:
Sometime ago on the comp.lang.c, I saw a teacher's post asking why C compilers produce so many error messages as soon as a closing bracket is missing. The response was simply because the compiler...
6
by: PW | last post by:
I've created an ASP application which uses an Access database. I've created an outer join query, but for some reason the "Property_Def" column is not aligning with the "ESPN" column. They should...
11
by: designkitt | last post by:
Hello, I am having a problem aligning a cell in a table and have tried everything I can think of to correct this without any luck: It appears that the white area, which is an image in the background...
0
by: dudethat | last post by:
Hello, im brand new to forums and as you will see to css! The problem im having here is the text i want in the cell (class hd) refuses to align to the top in firefox. Ive tried placing it straight...
2
by: JJA | last post by:
Please advise on how I can get this content (from "Choose a Map" down to the "Show Map" button) to be positioned at the top of this table cell. Please see: ...
4
by: O11Y | last post by:
Hello, I've read numerous posts & guides on this subject but i'm still having problems. I'm writing some HTML for the company intranet and all our browsers are currently (you guessed it) IE6. ...
2
by: billsahiker | last post by:
Why is the top of my right-side table not even with the top of the left-side table? I want them both to align at the top of the page, in the content area (master page based asp project). I have...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.