<?php
    include('../loginsession.php');
    error_reporting(E_ALL);
    $filename = basename(__FILE__);
    $save = mysqli_query($conn, "INSERT INTO novia_abc_user_logs (userid,filename) VALUES ('$userini_id','$filename')");
//-------------
//$today = date("Y-m-d");
//-------------
    if(isset($_GET['id'])){
    $id = $_GET['id'];
    }
    if(isset($_GET['tgl'])){
    $tgl = $_GET['tgl'];
    }
    if(isset($_GET['aero'])){
    $aeros = $_GET['aero'];
    }
        if ($aeros == 'aero'){
            $aerom = 'aero_main.php';
        } else {
            $aerom = 'meditation.php';
        }
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//ID" "http://www.w3.org/TR/html4/frameset.dtd">
<html lang="id">
<head>
   <title>EDIT AEROMED</title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" type="text/css" href="../css/style.css">
	<link rel="stylesheet" type="text/css" href="../css/new.css">
	<link href="../images/balance.ico" rel="icon" type="image/icon"/>
	<style>
    	body {
            background-image : url('#');
            background-color: #fff;
    	}
        .box{
			max-width: 100px;
			margin: 10px;
			font-family: "Time New Roman";
			color:#ccc;
			/*display: flex; justify-content: center; align-items: center;*/
		}
		a { text-decoration: none; color:inherit;}
		a:hover {color:#FF00FF;}   /* Mouse over link */
    	
    	
    	
    	
    </style>	

</head>
<body>
<br>
<?php
$sql = "SELECT * FROM novia_abc_user_aero
        WHERE userid = $id
            AND DATE_FORMAT(tanggal, '%Y-%m-%d') = '$tgl'
        ORDER BY tanggal DESC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        if ($aeros == 'aero'){
            $aeromed = $row['aero'];
        } else {
            $aeromed = $row['meditation'];
        }
        ?>
<br>

        <div style="text-align:center;">
        <form  method="post"  action="edit-aeromed-update.php?id=<?php echo $row['id']; ?>&aero=<?php echo $aerom; ?>">
            
            <input type="text" name="tgl" placeholder="" size="15" maxlength="30" autocomplete="off" autofocus value="<?php echo $row['tanggal']?>"/>
            <input type="text" name="jumlah" placeholder="" size="3" maxlength="6" autocomplete="off" autofocus value="<?php echo $aeromed ?>"/>
            <button type="submit" name="simpan" style="padding: 2px; width: 100px">UPDATE</button>
            
        </form>
        </div>
<br>
<div style="display: flex; justify-content: center; align-items: stretch; gap: 20px;">
    <div>
        <a href="edit-aeromed-hapus.php?id=<?php echo $row['id']; ?>&aero=<?php echo $aerom; ?>"
           class="btn-pastel-green" 
           title="">
           HAPUS ITEM
        </a>
    </div>
    <div>
        <a href="<?php echo $aerom; ?>" 
           class="btn-soft-lavender" 
           title="Kembali ke halaman sebelumnya">
           KEMBALI
        </a>
    </div>
</div>
    
<br>

           
<?php           
    }
} else {
    echo "<p style='font-size:22px; text-align:center;'>tidak ada data</p>";
    ?>
	<div style="text-align:center;">
        <a href="<?php echo $aerom; ?>" 
           class="btn-soft-lavender" 
           title="Kembali ke halaman sebelumnya">
           KEMBALI
        </a>
    </div>
    <?php
}
?>


    
</body>
    