Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start(); // Right at the top of your script
- ?>
- <?php
- include("config.php");
- // cek apakah tombol daftar sudah diklik atau blum?
- if(isset($_POST['regist'])){
- // ambil data dari formulir
- $username = $_POST['username'];
- $password = $_POST['password'];
- $city = $_POST['city'];
- $_SESSION['username']=$username;
- $_SESSION['logged']=true;
- // buat query
- $sql = "INSERT INTO registrasi (username, password, city) VALUE ('$username', '$password', '$city')";
- $query = mysqli_query($db, $sql);
- // apakah query simpan berhasil?
- if( $query ) {
- // kalau berhasil alihkan ke halaman index.php dengan status=sukses
- header('Location: pwebuts2.php');
- } else {
- // kalau gagal alihkan ke halaman indek.php dengan status=gagal
- header('Location: regispweb.php?status=gagal');
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement