<?php include("config/connection.php"); ?>

<?php 

$actget = $_GET['actget'];
$act = $_POST['act'];
$id = $_POST["id"];
$idjadwal = $_POST['idjadwal'];
$idabk = $_POST['idabk'];
$idangkutan = $_POST['idangkutan'];
$harga = $_POST['harga'];

//TAMBAH DATA
if ($act == 1){

	$sql="insert into tb_jadwal_detil (id_jadwal, id_abk) VALUES('$idjadwal','$idabk')";
	if (!mysql_query($sql,$test)){
  	die('Error: ' . mysql_error());
	}
?>
<script>window.location = "<?php echo $base?>data-jadwal-detil/<?php echo $idjadwal?>"</script>
<?php

//NONAKTIF DATA
}elseif($act == 3){
	$sql="delete from tb_jadwal_detil where id = '".$id."'";
	if (!mysql_query($sql,$test)){
  	die('Error: ' . mysql_error());
	}
?>
<script>window.location = "<?php echo $base?>data-jadwal-detil/<?php echo $idjadwal?>"</script>
<?php

//TAMBAH DATA ANGKUTAN
}elseif($act == 2){
	$sql="insert into tb_detil_angkutan (id_jadwal, id_angkutan, harga) values ('".$idjadwal."', '".$idangkutan."', '".$harga."')";
	if (!mysql_query($sql,$test)){
  	die('Error: ' . mysql_error());
	}
?>
<script>window.location = "<?php echo $base?>data-jadwal-harga/<?php echo $idjadwal?>"</script>
<?php

//HAPUS DATA ANGKUTAN
}elseif($act == 4){
	$sql="delete from tb_detil_angkutan where id = '".$id."' ";
	if (!mysql_query($sql,$test)){
  	die('Error: ' . mysql_error());
	}
?>
<script>window.location = "<?php echo $base?>data-jadwal-harga/<?php echo $idjadwal?>"</script>
<?php } ?>