Tutorial Programming

Tutorial membuat table zebra atau warna-warni dengan PHP


Hallo sahabat pasti pernah nih mau cari tau gimana yah, membuat table warna-warni atau table zebra kayak website orang-orang, tanpa bootstrap nih hehehehe , oke kita langsung aja.

Copy coding tersebut

<?php
$baris= 1;
echo "<table width=\"400\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#ffffff\">";
echo "<tr bgcolor=\"#00CC00\">";
echo "<th>No.</th>";
echo "<th>Nama</th>";
echo "<th>Alamat</th>";
echo "</tr>";
for($i=1; $i<=10;$i++) {
    $warna= ($baris% 2 == 1) ? "#cccccc" : "#99FF99";
    echo "<tr bgcolor=\"".$warna."\">";
    echo "<td>$i</td>";
    echo "<td>Nama $i</td>";
    echo "<td>Alamat $i</td>";
    echo "</tr>";
    $baris++;
}
echo "</table>";
?>


Sekian tutorial saya sahabat semoga bermanfaat yah.

No comments:

Post a Comment

Tutorial Programming Designed by Templateism | Ary EJFA Copyright © 2015

Theme images by richcano. Powered by Blogger.