Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once '../dbconnect.php';
- include_once '../functions.php';
- ini_set('display_errors', 1);
- ini_set('display_startup_errors', 1);
- error_reporting(E_ALL);
- /* Select queries return a resultset */
- if ($result = mysqli_query($con, "SELECT * FROM main_menu")) {
- $select = ' "Select returned %d rows.\n", mysqli_num_rows($result));';
- /* free result set */
- mysqli_free_result($result);
- }
- if(isset($_GET['delete_id'])) {
- $result="DELETE FROM main_menu WHERE m_menu_id=".$_GET['delete_id'];
- mysqli_query($con, $result) or die(mysqli_error());
- header("Location: delete_menu.php");
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>PHP Delete Data With Javascript Confirmation - By Cleartuts</title>
- <link rel="stylesheet" href="../css/admin.css" type="text/css" />
- <script type="text/javascript">
- function delete_id(id)
- {
- if(confirm('Sure To Remove This Record ?'))
- {
- window.location.href='delete_menu.php?delete_id='+id;
- }
- }
- </script>
- </head>
- <body>
- <center>
- <div id="header">
- <div id="content">
- </div>
- </div>
- <div id="body">
- <div id="content">
- <table class="table" align="center" border="1" cellspacing="1" cellpadding="2">
- <thead>
- <th>Id</th>
- <th>Title</th>
- <th>Action</th>
- </thead>
- <?php
- $res=$con->query("SELECT * FROM main_menu");
- while($row=$res->fetch_array()) { ?>
- <tr>
- <td><?php echo $row['m_menu_id']; ?></td>
- <td><?php echo $row['m_menu_name']; ?></td>
- <td align="center"><a href="javascript:delete_id(<?php echo $row['m_menu_id']; ?>)"><img src="delete.png" alt="Delete" /></a></td>
- </tr>
- <?php
- }
- ?>
- </table>
- </div>
- </div>
- </center>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement