Posted By

crishnakh on 11/10/08


Tagged

php table color rows


Versions (?)

Color to rows in a table


 / Published in: PHP
 

URL: http://www.webtaller.com/construccion/lenguajes/php/lecciones/colorear-tablas-datos-en-php.php

  1. <?
  2. if($bgcolor == '#FFFFFF')$bgcolor = '#F5F5F5';
  3. else $bgcolor = '#FFFFFF';
  4. ?>
  5.  
  6. ----
  7.  
  8. <?
  9. $vector = array("ar.gif", "cl.gif", "co.gif", "cr.gif", "do.gif", "es.gif", "mx.gif", "pe.gif", "ve.gif");
  10. $vector2 = array("Argentina", "Chile", "Colombia", "Costa Rica", "República Dominicana", "España", "Méjico", "Perú", "Venezuela");
  11. for($i=0;$i<count($vector);$i++){
  12. if($bgcolor == '#FFFFFF')$bgcolor = '#F5F5F5';
  13. else $bgcolor = '#FFFFFF';
  14. echo ' <tr>
  15. <td width="100%" bgcolor="'.$bgcolor.'"><img src="'.$vector[$i].'"> '.$vector2[$i].'</td>
  16. </tr>
  17. ';
  18. }
  19. ?>

Report this snippet  

You need to login to post a comment.