<?php
if ($c['level']=="superadmin") {

$id = $_GET['id'];
$q = mysqli_query($koneksi,"SELECT * FROM tb_popular WHERE id='$id'");
$d = mysqli_fetch_array($q);
?>

<div class="container-fluid">
<div class="row">
<div class="col-lg-6">
<div class="card">
<div class="card-body">

<h4>Edit Popular</h4>

<form method="POST" action="?page=proses_edit_popular" enctype="multipart/form-data">
<input type="hidden" name="id" value="<?= $d['id']; ?>">

<div class="form-group">
<label>Title</label>
<input type="text" name="title" value="<?= $d['title']; ?>" class="form-control">
</div>

<div class="form-group">
<label>Provider</label>
<input type="text" name="provider" value="<?= $d['provider']; ?>" class="form-control">
</div>

<div class="form-group">
<label>Image</label><br>
<img src="../../uploads/popular/<?= $d['image']; ?>" width="120">
<input type="file" name="image" class="form-control mt-2">
</div>

<div class="form-group">
<label>Players</label>
<input type="number" name="players" value="<?= $d['players']; ?>" class="form-control">
</div>

<div class="form-group">
<label>Status</label>
<select name="status" class="form-control">
<option value="active" <?= $d['status']=="active"?"selected":""; ?>>Active</option>
<option value="inactive" <?= $d['status']=="inactive"?"selected":""; ?>>Inactive</option>
</select>
</div>

<div class="form-group">
<label>Sort</label>
<input type="number" name="sort" value="<?= $d['sort']; ?>" class="form-control">
</div>

<button type="submit" class="btn btn-success">Update</button>

</form>
</div>
</div>
</div>
</div>
</div>

<?php
}else{
echo "<script>window.location='?page=dashboard'</script>";
}
?>