<?php
    include('loginsession.php');
    error_reporting(E_ALL);
    $filename = __FILE__;  //---Nama file saat ini
    if (strlen(__FILE__) > 48) {$filename = substr(__FILE__, 48);}
    $save = mysqli_query($conn, "INSERT INTO novia_abc_user_logs (userid,filename) VALUES ('$userini_id','$filename')");
//-------------

//ambil data berdasarkan parameter GET id
$b = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM novia_abc_biodata where id='$_GET[id]'"));
//$id=  $_POST['id']; 
$mr=  $_GET['id']; 
$nama=  $_POST['name']; 
$phone_wa=  $_POST['phone_wa'];
$phone_home=  $_POST['phone_home']; 
$street_address=  $_POST['street_address'];
$kelurahan=  $_POST['kelurahan']; 
$kecamatan=  $_POST['kecamatan']; 
$city=  $_POST['city']; 
$state=  $_POST['state']; 
$kode_pos=  $_POST['kode_pos']; 
$email=  $_POST['email']; 
$firstcome=  $_POST['firstcome'];
$lastcome=  $_POST['lastcome'];
$birthday=  $_POST['birthday']; $height=  $_POST['height'];
$note=  $_POST['note']; 
$password = $_POST['password'];
if ( $userini_id == "3"){
    $password = 000;
}
	if ( $password != 000 ) {
        echo "<script>alert('Password Anda Salah');document.location='biodata_edit.php?id=$mr'</script>";
	} else { $save=mysqli_query($conn, "UPDATE novia_abc_biodata SET mr='$mr',name='$nama',phone_wa='$phone_wa',phone_home='$phone_home',street_address='$street_address',kelurahan='$kelurahan',kecamatan='$kecamatan', city='$city', state='$state', kode_pos='$kode_pos', email='$email', firstcome='$firstcome', lastcome='$lastcome',birthday='$birthday', height='$height', note='$note'   where mr='$mr'");
	if($save){
        $save1 = mysqli_query($conn, "INSERT INTO novia_abc_activity (mr) VALUES ('$mr')");
        echo "<script>document.location='biodata.php?id=$mr'</script>";
    }else{  //jika update gagal maka muncul pesan
         echo "<script>alert('Proses simpan gagal, coba kembali');document.location='biodata_edit.php?id=$mr'</script>";
    }
	}

?>
