SHARE
TWEET

Untitled

a guest Oct 13th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. include 'koneksi.php';
  3.  
  4. if(isset($_POST['save'])){
  5. $Nama = $_POST['Nama'];
  6. $Username = $_POST['Username'];
  7. $Password = $_POST['Password'];
  8. $Email = $_POST['Email'];
  9.  
  10. $query = "INSERT INTO `data` (`Id`, `Nama`, `Username`, `Password`, `Email`) VALUES (NULL, '$Nama', '$Username', '$Password', '$Email');";
  11.  
  12. if(mysqli_query($koneksi, $query)){
  13.     header("location:index.php");
  14. }else{
  15.  
  16.  
  17. }
  18.  
  19. }
  20.  
  21.  
  22.  ?>
  23. <!DOCTYPE html>
  24. <html>
  25. <head>
  26.     <title>Membuat CRUD Dengan PHP Dan MySQL</title>
  27.     <link rel="stylesheet" type="text/css" href="bootstrap.min.css">
  28. </head>
  29. <body>
  30.     <div class="judul bg-dark text-light p-3 mt-3 mb-3">       
  31.         <h1>Membuat CRUD Dengan PHP Dan MySQL</h1>
  32.     </div>
  33.    
  34.     <br/>
  35.  
  36.     <a href="index.php" class="btn btn-info">Lihat Semua Data</a>
  37.  
  38.     <br/>
  39.     <h3>Input data baru</h3>
  40.     <form action="" method="post">     
  41.         <table>
  42.             <tr>
  43.                 <td>Nama</td>
  44.                 <td><input type="text" name="Nama" required></td>                  
  45.             </tr>  
  46.             <tr>
  47.                 <td>Username</td>
  48.                 <td><input type="text" name="Username" required></td>                  
  49.             </tr>
  50.             <tr>
  51.                 <td>Password</td>
  52.                 <td><input type="text" name="Password" required></td>                  
  53.             </tr>
  54.             <tr>
  55.                 <td>Email</td>
  56.                 <td><input type="text" name="Email" required></td>                 
  57.             </tr>  
  58.             <tr>
  59.                 <td></td>
  60.                 <td><input type="submit" value="Simpan" name="save" class="btn btn-warning"></td>                  
  61.             </tr>              
  62.         </table>
  63.     </form>
  64.     <script type="text/javascript" src="bootstrap.min.js"></script>
  65. </body>
  66. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top