/
/
home
/
u523034047
/
domains
/
commerciesconsultancy.com
/
public_html
/
admin
Server: in-mum-web1112.main-hosting.eu (62.72.28.111)
You: 216.73.216.60
PHP 8.3.16
Dir:
/home/u523034047/domains/commerciesconsultancy.com/public_html/admin
Edit:
/home/u523034047/domains/commerciesconsultancy.com/public_html/admin/add_testimonial.php
<?php include('conn.php'); session_start(); if (!isset($_SESSION['username'])) { header('location:index.php'); exit(); } else { if(isset($_POST['add_testimonial'])){ $name = mysqli_real_escape_string($connection, $_POST['name']); $testimonial = mysqli_real_escape_string($connection, $_POST['testimonial']); $sql = "INSERT INTO testimonials (name, testimonial) VALUES ('$name', '$testimonial')"; if(mysqli_query($connection, $sql)){ echo "<script>alert('Testimonial Added Successfully');</script>"; } else { echo "<script>alert('Error adding testimonial');</script>"; } } } ?> <?php if(isset($_POST['delete'])){ $id = $_POST['delete_id']; mysqli_query($connection, "DELETE FROM testimonials WHERE id='$id'"); } ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Admin</title> <!-- BOOTSTRAP STYLES--> <link href="assets/css/bootstrap.css" rel="stylesheet" /> <!-- FONTAWESOME STYLES--> <link href="assets/css/font-awesome.css" rel="stylesheet" /> <!-- CUSTOM STYLES--> <link href="assets/css/custom.css" rel="stylesheet" /> <!-- GOOGLE FONTS--> <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' /> </head> <body> <div id="wrapper"> <div class="navbar navbar-inverse navbar-fixed-top"> <?php include ('header.php');?> </div> <!-- /. NAV TOP --> <nav class="navbar-default navbar-side" role="navigation"> <?php include ('menu.php');?> </nav> <!-- /. NAV SIDE --> <div id="page-wrapper" > <div id="page-inner"> <form method="POST"> <div class="form-group"> <label>Enter Name</label> <input type="text" name="name" class="form-control" required> </div> <div class="form-group"> <label>Enter Testimonial</label> <textarea name="testimonial" class="form-control" rows="3" required></textarea> </div> <button type="submit" name="add_testimonial" class="btn btn-primary mt-2"> Add Testimonial </button> </form> <!-- /. ROW --> <hr /> <div class="panel panel-primary" data-collapsed="0"> <div class="panel-heading"> <div class="panel-title" > <i class="entypo-plus-circled"></i> </div> </div> <div class="panel-body"> <div style="overflow-x:auto;"> <div class="col-lg-12 col-md-12"> <div class="table-responsive"> <table class="table"> <thead> <tr> <th>#</th> <th>Name</th> <th>Description</th> <th>Action</th> </tr> </thead> <?php $sql = "SELECT * FROM testimonials ORDER BY id DESC"; $query = mysqli_query($connection, $sql); ?> <table class="table table-bordered"> <?php while($row = mysqli_fetch_array($query)){ ?> <tr> <td><?php echo $row['id']; ?></td> <td><?php echo $row['name']; ?></td> <td><?php echo $row['testimonial']; ?></td> <td> <form method="post"> <input type="hidden" name="delete_id" value="<?php echo $row['id']; ?>"> <button type="submit" name="delete" class="btn btn-danger">Delete</button> </form> </td> </tr> <?php } ?> </table> </table> </div> </div> </div> </div> </div> </div> </div> <!-- /. PAGE INNER --> </div> <!-- /. PAGE WRAPPER --> </div> <div class="footer"> <?php include ('footer.php');?> </div> <!-- /. WRAPPER --> <!-- SCRIPTS -AT THE BOTOM TO REDUCE THE LOAD TIME--> <!-- JQUERY SCRIPTS --> <script src="assets/js/jquery-1.10.2.js"></script> <!-- BOOTSTRAP SCRIPTS --> <script src="assets/js/bootstrap.min.js"></script> <!-- CUSTOM SCRIPTS --> <script src="assets/js/custom.js"></script> </body> </html>
Ukuran: 5.0 KB