Commit 77ac25d1 by Roy Junedi Simamora

Penambahan fungsi menampilkan komentar dan menghapus komentar oleh admin

parent 9e0e90ee
<?php
require 'koneksi.php';
if(isset($_POST['kirim'])){
$nama = $_POST['name'];
$hp = $_POST['phone'];
$email = $_POST['email'];
$comment = $_POST['comment'];
}
$input = mysql_query("INSERT INTO komentar VALUES('','$nama','$comment', '$email', '$hp')") or die(mysql_error());
if($input){
header('Location: form_comment.php');
}else{
echo'gagal memberikan komentar!';
header('Location: form_comment.php');
}
?>
\ No newline at end of file
<?php
require 'koneksi.php';
include 'common/header.php';
?>
<div class="container-fluid">
<h2> Daftar Feedback </h2>
<hr/>
<?php
$komen = mysql_query("SELECT * FROM komentar");
while($q = mysql_fetch_array($komen)){
?>
<div class="col-md-4">
<div class="thumbnail">
<label> Nama: &nbsp; <span> <?php echo $q['nama'] ?> </span> </label> <br>
<label> <span> <?php echo $q['email'] ?> </span> </label> <br>
<label> <span> <?php echo $q['hp'] ?> </span> </label> <br>
<label> Komentar : </label> <br>
<?php echo $q['isi'] ?>
<br> <br>
<div align="center">
<a onclick="if(confirm('Anda yakin ingin menghapus komentar ini?')){
location.href='hapus_komen.php?id=<?php echo $q['id_komentar'] ?>'
}" class="btn btn-danger"> <span class="glyphicon glyphicon-remove"> </span> Hapus </a>
</div>
</div>
</div>
<?php
}
?>
</div>
<?php include 'common/footer.php'; ?>
\ No newline at end of file
<?php
include 'koneksi.php';
$id = $_GET['id'];
mysql_query("DELETE FROM komentar WHERE id_komentar = '$id'");
header('Location: daftar_komen.php');
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment