Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Insert Data Mahasiswa</title>
- </head>
- <body>
- <?php
- $host = "localhost";
- $username = "root";
- $password = "";
- $nama_db = "1084_db";
- $koneksi_db = mysqli_connect($host,$username,$password,$nama_db) or die (mysqli_error());
- if($koneksi_db)
- {
- $student_number = (isset($_POST['student_number']))? $_POST['student_number']: '';
- $student_name = (isset($_POST['student_name']))? $_POST['student_name']: '';
- $province = (isset($_POST['province']))? $_POST['province']: '';
- $distric = (isset($_POST['distric']))? $_POST['distric']: '';
- $region= (isset($_POST['region']))? $_POST['region']: '';
- $perintah_sql = "INSERT INTO student set
- student_number = '".$_POST['student_number']."',
- student_name = '".$_POST['student_name']."',
- province = '".$_POST['province']."',
- distric = '".$_POST['distric']."',
- region = '".$_POST['region']."' ";
- echo "$perintah_sql";
- echo "<br>";
- mysqli_query($koneksi_db,$perintah_sql) or die ("Proses Insert data GAGAL! <br> mysqli_error()");
- echo "Proses Insert data Berhasil";
- echo "<br>";
- echo "[<a href=view.php>Lihat Data Mahasiswa</a>]";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement