<?php include '_head.php'; if($_SERVER['REQUEST_METHOD']=='POST'){ $pos=mysqli_real_escape_string($conn,$_POST['position']); $ten=mysqli_real_escape_string($conn,$_POST['title_en']); $tar=mysqli_real_escape_string($conn,$_POST['title_ar']); $sen=mysqli_real_escape_string($conn,$_POST['subtitle_en']); $sar=mysqli_real_escape_string($conn,$_POST['subtitle_ar']); $img=upload_file('image','uploads/banners'); mysqli_query($conn,"INSERT INTO banners(title_en,title_ar,subtitle_en,subtitle_ar,image,position,status) VALUES('$ten','$tar','$sen','$sar','$img','$pos',1)"); } if(isset($_GET['delete'])){mysqli_query($conn,"DELETE FROM banners WHERE id=".(int)$_GET['delete']);} $rs=mysqli_query($conn,"SELECT * FROM banners ORDER BY id DESC"); ?><h1>Banners</h1><form class="admin-card" method="post" enctype="multipart/form-data"><select name="position"><option value="hero">Hero Slider</option><option value="banner80">banner-80</option></select><input name="title_en" placeholder="English title"><input name="title_ar" placeholder="Arabic title"><input name="subtitle_en" placeholder="English subtitle"><input name="subtitle_ar" placeholder="Arabic subtitle"><input type="file" name="image"><button class="primary-btn">Add Banner</button></form><table class="table"><tr><th>ID</th><th>Position</th><th>Title</th><th></th></tr><?php while($r=mysqli_fetch_assoc($rs)): ?><tr><td><?php echo $r['id']; ?></td><td><?php echo e($r['position']); ?></td><td><?php echo e($r['title_en']); ?></td><td><a href="?delete=<?php echo $r['id']; ?>">Delete</a></td></tr><?php endwhile; ?></table><?php include '_foot.php'; ?>
