<?php

include 'manajemen-gedung.php';
$obj = new Gedung("localhost", "root", "", "wedding");
if (isset($_REQUEST['submit'])) {
    extract($_REQUEST);
    $obj->ubah($id, $nama, $kota, $deskripsi, $gambar);
}
if (isset($_REQUEST['id'])) {
    $id = $_REQUEST['id'];
    $result = $obj->mysqli->query("SELECT * FROM gedung WHERE id='{$id}'");
    $rows = $result->fetch_assoc();
    extract($rows);
}
?>
<!DOCTYPE html>
<html>
<body>
<!--masih salah-->
<form method="post" action="#.php">
<table width="500" border="1" cellpadding="5">
  <tr>
    <th width="154" scope="row">Name</th>
    <td width="314"><input type="text" name="name" size="30" value="<?php 
echo $name;
?>
" /></td>
  </tr>
  <tr>
    <th scope="row">Email</th>
    <td><input type="text" name="email" size="30" value="<?php 
<?php

include 'manajemen-gedung.php';
//include_once ('head-back.php');
//echo "<div class='span6 offset1'>";
$obj = new Gedung("localhost", "root", "", "wedding");
if (isset($_REQUEST['submit'])) {
    $id = $_REQUEST['ubah'];
    $nama_gedung = $_POST['nama_gedung'];
    $id_kota = $_POST['id_kota'];
    $kapasitas = $_POST['kapasitas'];
    $deskripsi = $_POST['deskripsi_gedung'];
    if (empty($nama_gedung) || empty($kapasitas) || empty($deskripsi)) {
        $error_tambah = "Data tidak boleh kosong";
    }
    if (isset($_FILES['image']) && $_FILES['image']['size'] > 0) {
        //$gambar_gedung= echo $_FILE['image']['name'];
        extract($_REQUEST);
        $obj->ubah($id, $nama_gedung, $id_kota, $deskripsi, $kapasitas);
    } else {
        $error_tambah = "Gambar tidak boleh kosong";
    }
}