G2A Many GEOs
SHARE
TWEET

index

a guest Jul 11th, 2017 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $conn = mysql_connect('localhost','root','','tutorial_1');
  3. $no = mysql_query($conn,"SELECT kode_anggota From tb_anggota");
  4. $kd_anggota = mysql_fetch_array($no);
  5. $kode = $kd_anggota['kode_anggota'];
  6.  
  7. $urut = substr($kode, 6, 3);
  8. $tambah = (int) $urut + 1;
  9. $bln = date ("m");
  10. $thn = date ("y");
  11.  
  12. if (strlen($tambah)===1) {
  13.     $format = "BW".$bln.$thn."00".$tambah;
  14. } else if (strlen($tambah)===2) {
  15.     $format = "BW".$bln.$thn."0".$tambah;
  16. } else {
  17.     $format = "BW".$bln.$thn.$tambah;
  18. }
  19.  
  20. if(isset($_POST['submit'])){
  21.     $no_urut = $_POST['no_urut'];
  22.     $nama =$_POST['nama'];
  23.     mysql_query($conn,"INSERT INTO tb_anggota(kode_anggota, nama_anggota) VALUES($no_urut','$nama')");
  24.     header("location:index.php?success");
  25. }
  26. ?>
  27. <!DOCTYPE html>
  28. <html>
  29. <head>
  30.     <title>no. urut</title>
  31. </head>
  32. <body>
  33. <?php
  34. if(isset($_GET['success'])){
  35. echo"<h4>Data Berhasil Disimpan!</h4>";
  36. }
  37. ?>
  38. <form method="post" action="">
  39.     <table>
  40.     <tr>
  41.         <td>No. urut</td>
  42.         <td><input type="text" name="no_urut" value="<?php echo $format; ?>" readonly></td>
  43.     </tr>
  44.     <tr>
  45.         <td>Nama</td>
  46.         <td><input type="text" name="nama" value=""></td>
  47.     </tr>
  48.     <tr>
  49.         <td></td>
  50.         <td><input type="submit" name="submit" value="Simpan"></td>
  51.     </tr>
  52.    
  53.     </table>
  54. </form>
  55. </body>
  56. </html>
RAW Paste Data
Ledger Nano X - The secure hardware wallet
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