Hadi1989

Untitled

Jul 6th, 2018
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.88 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.     <head>
  4.         <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1"/>
  5.         <link rel="stylesheet" type="text/css" href="css/bootstrap.css" />
  6.     </head>
  7. <body>
  8.     <nav class="navbar navbar-default">
  9.         <div class="container-fluid">
  10.             <a class="navbar-brand" href="">itsaudara</a>
  11.         </div>
  12.     </nav>
  13.     <div class="col-md-3"></div>
  14.     <div class="col-md-6 well">
  15.         <h3 class="text-primary">PHP - Export MySQLi Database To Excel</h3>
  16.         <hr style="border-top:1px dotted #ccc;"/>
  17.         <button class="btn btn-primary" data-toggle="modal" data-target="#form_modal"><span class="glyphicon glyphicon-plus"></span> Add Member</button>
  18.         <form method="POST" action="excel.php">
  19.         <button class="btn btn-success pull-right" name="export"><span class="glyphicon glyphicon-print"></span> Export Excel</button>
  20.         </form>
  21.         <br /><br />
  22.         <table class="table table-bordered">
  23.             <thead class="alert-info">
  24.                 <tr>
  25.                     <th>Firstname</th>
  26.                     <th>Lastname</th>
  27.                     <th>Address</th>
  28.                     <th>Job</th>
  29.                 </tr>
  30.             </thead>
  31.             <tbody>
  32.                 <?php
  33.                     require 'conn.php';
  34.                    
  35.                     $query = $conn->query("SELECT * FROM `member`");
  36.                     while($fetch = $query->fetch_array()){
  37.                 ?>
  38.                 <tr>
  39.                     <td><?php echo $fetch['firstname']?></td>
  40.                     <td><?php echo $fetch['lastname']?></td>
  41.                     <td><?php echo $fetch['address']?></td>
  42.                     <td><?php echo $fetch['job']?></td>
  43.                 </tr>
  44.                 <?php
  45.                     }
  46.                 ?>
  47.             </tbody>
  48.         </table>
  49.     </div>
  50.     <div class="modal fade" id="form_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  51.         <div class="modal-dialog" role="document">
  52.             <form action="save_query.php" method="POST">
  53.                 <div class="modal-content">
  54.                     <div class="modal-body">
  55.                         <div class="col-md-2"></div>
  56.                         <div class="col-md-8">
  57.                             <div class="form-group">
  58.                                 <label>Firstname</label>
  59.                                 <input type="text" class="form-control" name="firstname"/>
  60.                             </div>
  61.                             <div class="form-group">
  62.                                 <label>Lastname</label>
  63.                                 <input type="text" class="form-control" name="lastname"/>
  64.                             </div>
  65.                             <div class="form-group">
  66.                                 <label>Address</label>
  67.                                 <input type="text" class="form-control" name="address"/>
  68.                             </div>
  69.                             <div class="form-group">
  70.                                 <label>Job</label>
  71.                                 <input type="text" class="form-control" name="job"/>
  72.                             </div>
  73.                         </div>
  74.                     </div>
  75.                     <div style="clear:both;"></div>
  76.                     <div class="modal-footer">
  77.                         <button type="button" class="btn btn-danger" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span> Close</button>
  78.                         <button name="save" class="btn btn-primary"><span class="glyphicon glyphicon-save"></span> Save</button>
  79.                     </div>
  80.                 </div>
  81.             </form>
  82.         </div>
  83.     </div>
  84. </body>
  85. <script src="js/jquery-3.2.1.min.js"></script>
  86. <script src="js/bootstrap.js"></script>
  87. </html>
Advertisement
Add Comment
Please, Sign In to add comment