Not work good table in Internet Explorer

Discussion in 'PHP' started by georgege, Apr 17, 2009.

  1. #1
    Hi,

    My table not good in Internet Explorer, is align left and not work link.
    In Firefox is good, is align center and link work good.
    Why not work good in browser Internet Explorer?
    Why I mistake? Someone can help me?

    <TABLE cellSpacing=0 cellPadding=0 width=173 height="180" align=center border=1>
            <TBODY>
              <TR>
                <TD>  <div align="center"><br />
                  
                  <table bgcolor="#FF8C00" cellSpacing="0" cellPadding="0" width="160" height="180" align="center">
                    <tr><td width="100">
                    
                    <table bgcolor="#CCCCCC" align="center" style="height:auto">
                    <tr><td bgcolor="#FF8C00" height="5" width="148"></td></tr>
                    <tr><td height="5" width="148"><div align="center">
    <a href="1.php">                
    <? 
    echo "<table>"; 
    echo "<tr bgcolor='#FF8C00'>";
    echo "<td>" . date('F d, Y', time() - 86400) . "</td>";
    echo "</tr>";
    echo "</table>";
    ?></a></div></td></tr>
                    <tr><td bgcolor="#FF8C00" width="143" style="height:auto"><div align="center">
    <a href="2.php">
    <? 
    echo "<table>"; 
    echo "<tr bgcolor='#CCCCCC'>";
    echo "<td>" . date('F d, Y', time() - 172800) . "</td>";
    echo "</tr>";
    echo "</table>";
    ?></a></div></td></tr>
                    <tr><td height="5" width="148"><div align="center">
    <a href="3.php">
    <?
    echo "<table>"; 
    echo "<tr bgcolor='#FF8C00'>";
    echo "<td>" . date('F d, Y', time() - 259200) . "</td>";
    echo "</tr>";
    echo "</table>";
    ?></a></div></td></tr>
                    <tr><td bgcolor="#FF8C00" width="143" style="height:auto"><div align="center">
    <a href="4.php">
    <?
    echo "<table>"; 
    echo "<tr bgcolor='#CCCCCC'>";
    echo "<td>" . date('F d, Y', time() - 345600) . "</td>";
    echo "</tr>";
    echo "</table>";
    ?></a></div></td></tr>
                    <tr><td height="5" width="148"><div align="center">
    <a href="5.php">
    <?
    echo "<table>"; 
    echo "<tr bgcolor='#FF8C00'>";
    echo "<td>" . date('F d, Y', time() - 432000) . "</td>";
    echo "</tr>";
    echo "</table>";
    ?></a></div></td></tr>
                    <tr><td bgcolor="#FF8C00" width="143" style="height:auto"><div align="center">
    <a href="6.php">
    <?
    echo "<table>"; 
    echo "<tr bgcolor='#CCCCCC'>";
    echo "<td>" . date('F d, Y', time() - 518400) . "</td>";
    echo "</tr>";
    echo "</table>";
    ?></a></div></td></tr>
                    <tr><td height="5" width="148"><div align="center">
    <a href="7.php">
    <?
    echo "<table>"; 
    echo "<tr bgcolor='#FF8C00'>";
    echo "<td>" . date('F d, Y', time() - 604800) . "</td>";
    echo "</tr>";
    echo "</table>";
    ?></a></div></td></tr>
                    <tr><td bgcolor="#FF8C00" width="143" height="5"><div align="center">
    <a href="8.php">
    <?
    echo "<table>"; 
    echo "<tr bgcolor='#CCCCCC'>";
    echo "<td>" . date('F d, Y', time() - 691200) . "</td>";
    echo "</tr>";
    echo "</table>";
    ?></a></div></td></tr>
                    <tr><td height="5" width="148"><div align="center">
    <a href="9.php">
    <?
    echo "<table>"; 
    echo "<tr bgcolor='#FF8C00'>";
    echo "<td>" . date('F d, Y', time() - 777600) . "</td>";
    echo "</tr>";
    echo "</table>";
    ?></a></div></td></tr>
                     <tr><td bgcolor="#FF8C00" width="143" height="5"><div align="center">
    <a href="10.php">
    <?
    echo "<table>"; 
    echo "<tr bgcolor='#CCCCCC'>";
    echo "<td>" . date('F d, Y', time() - 864000) . "</td>";
    echo "</tr>";
    echo "</table>";
    ?></a></div></td></tr>
                    </table>
                    
                    </td></tr>
                   </table><br />
    
                </div></TD></TR></TBODY></TABLE>
    Code (markup):
    Thanks in advance,
    george
     
    georgege, Apr 17, 2009 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    My first guess would be "totally messed up coding". Now - does it have to look exactly like that? Or would it be just as well if you had one table with a centered link within each row containing the date (with differing colors for each row)?
     
    PoPSiCLe, Apr 17, 2009 IP
  3. georgege

    georgege Greenhorn

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    18
    #3
    Can you show an example please?

    Regards,
    george
     
    georgege, Apr 17, 2009 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    Here you go, this does exactly the same as your code (apart from adding all the extra tables etc.) and it is completely valid XHTML / CSS-based. It is also a wee bit shorter. I didn't bother using the same colors, but you can just exchange the color-values as you please.
    
    <div style="text-align: center;">
    <table style="border: 1px solid black; width: 173px; height: 180px; text-align: center; margin: 0 auto;">
    <tbody>
    <?php
    $links = array('1.php','2.php','3.php','4.php','5.php','6.php','7.php','8.php','9.php','10.php');
    $num = count($links);
    for($i=0;$i<$num;$i++){ 
    	// if row number is even use first color, if it is odd use the second 
    	if($i % 2 ==0) { 
    	$bgcolor='#999'; 
    	} else { 
    	$bgcolor='#777'; 
        } 
    	// output the table row with the correct background color 
    ?>
         <tr style="background: <?php echo $bgcolor; ?>">
    		<td>
    		<a href="<?php echo $item; ?>">
    		<?php echo date('F d, Y', time() - (86400 * $i)); ?></a>
    		</td>
    	</tr>
    <?php } ?>
    </table>
    </div>
    
    PHP:
    If this helps, I'd appreciate a rep-point added :)
     
    PoPSiCLe, Apr 17, 2009 IP
  5. georgege

    georgege Greenhorn

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    18
    #5
    Excuse me but link not work for me, where I mistake?

    Regards,
    george
     
    georgege, Apr 18, 2009 IP
  6. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #6
    Oh, I'm sorry - I edited my original suggestion, and a couple of lines got messed up - here's the corrected code:
    
    <div style="text-align: center;">
    <table style="border: 1px solid black; width: 173px; height: 180px; text-align: center; margin: 0 auto;">
    <tbody>
    <?php
    $links = array('1.php','2.php','3.php','4.php','5.php','6.php','7.php','8.php','9.php','10.php');
    $num = count($links);
    $i=0;
    while(list(, $item) = each($links)){ 
    	// if row number is even use first color, if it is odd use the second 
    	if($i % 2 ==0) { 
    	$bgcolor='#999'; 
    	} else { 
    	$bgcolor='#777'; 
        }
    
    	// output the table row with the correct background color 
    ?>
         <tr style="background: <?php echo $bgcolor; ?>">
    		<td>
    		<a href="<?php echo $item; ?>">
    		<?php echo date('F d, Y', time() - (86400 * $i)); ?></a>
    		</td>
    	</tr>
    <?php
    $i++;
    } ?>
    </table>
    </div>
    
    PHP:
    retested, and works :) (You can see a test here: http://www.regncon.no/tabletest.php )
     
    PoPSiCLe, Apr 18, 2009 IP
  7. georgege

    georgege Greenhorn

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    18
    #7
    This not work in I Explorer (links not work).
    Can someone help me?

    Thanks in advance,
    george
     
    georgege, Apr 18, 2009 IP
  8. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #8
    Uhm, yes it does? The links works just fine, in all browsers. (Tested in Chrome, FF 3 and IE 7 / 8).
     
    PoPSiCLe, Apr 18, 2009 IP
  9. georgege

    georgege Greenhorn

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    18
    #9
    Excuse me, I mistake, table now work good. Thanks for all.

    Best Regards,
    george
     
    georgege, Apr 19, 2009 IP