Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $connection = mysql_connect("localhost", "root", "");
- $db = mysql_select_db("tes_db", $connection);
- $nama = $_POST['nama'];
- $username = $_POST['username'];
- $password = $_POST['password'];
- if (empty($nama)){
- echo "<script>alert('Nama belum diisi')</script>";
- echo "<meta http-equiv='refresh' content='1' url='daftar.php'>";
- }
- else
- if(empty($username)){
- echo "<script>alert('Username belum diisi')</script>";
- echo "<meta http-equiv='refresh' content='1' url='daftar.php'>";
- }
- else
- if (empty($password)){
- echo "<script>alert('Password belum diisi')</script>";
- echo "<meta http-equiv='refresh' content='1' url='daftar.php'>";
- }
- else
- {
- $daftar = mysql_query("INSERT INTO db_tes (id_siswa,nama_siswa,user_siswa,pass_siswa) values ('$nama','$username','$password')");
- if($daftar)
- {
- echo "<script>alert('Berhasil Mendaftar')</script>";
- echo "<meta http-equiv='refresh' content='1' url='daftar.php'>";
- }
- }
- else
- {
- echo "<script>alert('Gagal Mendaftar')</script>";
- echo "<meta http-equiv='refresh' content='1' url='daftar.php'>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement