//kode sebelumnya
if(empty($error)){
$cek = mysql_query("SELECT * FROM event WHERE event='$jam' AND date='$tgl'");
$masuk = mysql_num_rows($cek);
if($masuk > 0)
{
$error['tgl'] = 'Pilih tanggal lain';
$error['jam'] = 'Pilih jam lain';
}
else
{
$in = mysql_query("INSERT INTO event VALUES('','$jam','$name','$phone','$tgl')");
//echo $jam,$name,$phone,$tgl;
}
}
//kode sebelumnya
if(empty($error)){
$cek = mysql_query("SELECT * FROM event WHERE event='$jam' AND date='$tgl'");
$masuk = mysql_num_rows($cek);
if($masuk > 0)
{
$_SESSION['error'] = $error;
$_SESSION['post'] = $_POST;
echo '<script type="text/javascript">';
echo 'alert("Sorry, it is already filled\n Please select the other date");';
echo 'window.location.href="cal.php";';
echo '</script>';
}
else
{
$in = mysql_query("INSERT INTO event VALUES('','$jam','$name','$phone','$tgl')");
//echo $jam,$name,$phone,$tgl;
}
}
else{
$_SESSION['error'] = $error;
$_SESSION['post'] = $_POST;
header("location: cal.php");
}
Thanks,