SHARE
TWEET

Untitled

nununk Dec 14th, 2019 136 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. // pendaftaran   = nama database
  4. $conn = mysqli_connect("localhost", "root", "","tanggal");
  5.  
  6. // input = name dari tombol input, ketika kita klik tombol input maka akan di proses
  7. if (isset($_POST['input'])) {
  8. //Untuk tanggal otomatisnya
  9.     $tgl  = date('d - m - y');
  10. //Menyimpan ke database mysqli_query
  11.     mysql_query($conn, "insert into tanggal values('$tgl')"); echo "
  12.             <script>  
  13.             alert('Success');
  14.             window.location.href='index.php';  
  15.             </script>  
  16.             ";
  17.     }
  18.    
  19.     ?>
  20.  
  21. <!-- Menampilkan atau membuat file php atau html yang nantinya akan tampil di browser temen temen -->
  22.  
  23. <!DOCTYPE html>
  24. <html>
  25. <head>  
  26.     <title>Tanggal Otomatis</title>
  27. </head>
  28. <body>  
  29.     <form method="post">  
  30.         <input type="submit" name="input" value="input">  
  31.     </form>
  32. </body>
  33. </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