jawaban soal nomor 2
?php
error_reporting(~E_NOTICE); #ini digunakan utk menyembunyikan error khusus notice khususnya di index / beranda
$koneksi = new mysqli("localhost", "root", "", "db_kk0918");
if ($koneksi->connect_error)
{
echo "Gagal terhubung karena " . $koneksi->connect_error;
}
?>
<table border="1" width="80%" align="center">
<tr align="center">
<td colspan="2"><img src="images/header.png" height="64px" width="100%"></td>
</tr>
<tr>
<td width="10%">
<h3>Menu</h3>
<h2 style = background:#808080;color:white;border-Top:5;Border-left:5;border-right:5; border-bottom:5px solid #7FFF00; padding:10px 20px; text-decoration:none;font-family:Calibri; font-size:11pt; </h2> </style> <a href="index.php">Beranda</a><br>
<h2 style = background:#808080;color:white;border-Top:5;Border-left:5;border-right:5; border-bottom:5px solid #7FFF00; padding:10px 20px; text-decoration:none;font-family:Calibri; font-size:11pt; </h2> </style> <a href="index.php?hal=tentang.php">Tentang </a></br>
<h2 style = background:#808080;color:white;border-Top:5;Border-left:5;border-right:5; border-bottom:5px solid #7FFF00; padding:10px 20px; text-decoration:none;font-family:Calibri; font-size:11pt;</h2> </style> <a href="index.php?hal=entry.php">Entry (C)</a><br>
<h2 style = background:#808080;color:white;border-Top:5;Border-left:5;border-right:5; border-bottom:5px solid #7FFF00; padding:10px 20px; text-decoration:none;font-family:Calibri; font-size:11pt;</h2> </style> <a href="index.php?hal=tampil.php">Tampil (R)</a><br>
<h2 style = background:#808080;color:white;border-Top:5;Border-left:5;border-right:5; border-bottom:5px solid #7FFF00; padding:10px 20px; text-decoration:none;font-family:Calibri; font-size:11pt;</h2> </style> <a href="index.php?hal=ubah.php">Ubah (U)</a><br>
<h2 style = background:#808080;color:white;border-Top:5;Border-left:5;border-right:5; border-bottom:5px solid #7FFF00; padding:10px 20px; text-decoration:none;font-family:Calibri; font-size:11pt;</h2> </style> <a href="index.php?hal=hapus.php">Hapus (D)</a>
</td>
<td align="justify">
<?php
$hal = $_GET["hal"]; #echo $_GET["hal"]; utk nampilin isi yang dari kita get/post dari index.php?hal=xxx.php
if (isset($hal) && $hal!="")
{ #kondisi ini akan dijalankan jika variabel $hal digunakan dan variabel $hal isinya bukan kosong
include($hal);
}
else
{
echo "<h1>Selamat Datang</h1><p>Saya datang dari Habang, jauh menuntut ilmu, biarlah yang penting saya bisa. Saya yakin pasti bisa <strong>#nekbisanekkawa</strong></p>";
}
?>
</td>
</tr>
<tr align="center">
<td colspan="2" background="images/akbar.png">footer</td>
</tr>
</table>