<?php
	require_once('session.php');
    $users = $u['user'];
    $title = strtoupper($_POST['title']);
    $kode = $_POST['kode'];
    $time_result = $_POST['time_result'];
    $time_open = $_POST['time_open'];
    $close_result = $_POST['close_result'];
    $step_periode = $_POST['step_periode'];
    $website = $_POST['website'];
    $status = $_POST['status'];
    $postID = $_POST['postID'];
    $created_date = date('Y-m-d H:i:s');
    if($postID == ''){
        $query = mysqli_query($conn,"INSERT INTO `tb_pasaran` (`title`, `code`, `time_result`, `time_open`, `close_result`, `step_periode`, `website`, `status`) VALUES ('$title', '$kode','$time_result','$time_open','$close_result','$step_periode','$website','$status')") or die(mysqli_error());
        header('location:../pasaran/?notif=1');
    }
    else {
        $query = mysqli_query($conn,"UPDATE `tb_pasaran` SET `title` = '$title', `code` = '$kode', `time_result` = '$time_result', `time_open` = '$time_open', `close_result` = '$close_result', `step_periode` = '$step_periode', `website` = '$website', `status` = '$status' WHERE cuid = '$postID'") or die(mysqli_error());
        header('location:../pasaran/?catID='.$postID.'&notif=1');
    }
    
?>