Rabu, 19 Oktober 2011

Tugas Web Pro "Ann Beach Hotel"

Script “input_hotel.php”

Untitled Document

ANN BEACH HOTEL

Form Reservasi

No. Reservasi
:

Nama
:
No. Telp
:
Tanggal
:

Kamar
:

Jumlah Kamar
:

Kamar

Lama Hari
:

Hari

Script “koneksi.php”

$koneksi=mysql_connect("localhost","root","12345678") or die (mysql_error());

$cek=mysql_select_db("hotel",$koneksi);

if($cek)

echo "Koneksi berhasil";

else

echo "Gagal Koneksi";

?>

Script “simpan_hotel.php”

Untitled Document

include"../koneksi.php";

$no=$_POST[no];

$nama=$_POST[nama];

$telp=$_POST[telp];

$tgl=$_POST[tgl];

$kamar=$_POST[kamar];

$jml=$_POST[jml];

$lama=$_POST[lama];

if($kamar=="Standart")

{$harga=500000;}

else if($kamar=="Executive")

{$harga=750000;}

else if($kamar=="President")

{$harga=1000000;}

$total=$jml*$harga*$lama;

$simpan="insert into reservasi_hotel value('$no','$nama','$telp','$tgl','$kamar','$jml','$lama','$harga','$total')";

$cek=mysql_query($simpan) or die(mysql_error());

if($cek)

echo "Berhasil Disimpan";

else

echo "Gagal Disimpan";

?>

Tampilkan

Back

Script “tampil_hotel.php”

Untitled Document

$tampil="select*from reservasi_hotel";

$cek=mysql_query($tampil) or die (mysql_error());

while($data=mysql_fetch_array($cek))

{

?>

}

?>

Ann Beach Hotel

Reservasi Hotel

No.
Nama
Telp.
Tanggal
Kamar
Jumlah
Lama
Harga
Total
Edit
Hapus

Script “edit_hotel.php”

From Reservasi

include "../koneksi.php";

$id=$_GET[id];

$tampil="select*from reservasi_hotel where no='id'";

$cek=mysql_query($tampil) or die(mysql_error());

$data=mysql_fetch_array($cek);

?>

ANN BEACH HOTEL

Form Reservasi

No.
:

Nama
:
No. Telp
:
Tanggal
:

Kamar
:

Jumlah
:
Lama Hari
:

Script “hapus_hotel.php”

include "../koneksi.php";

$id=$_GET[id];

$hapus="delete from reservasi_hotel where no='$id'";

$cek=mysql_query($hapus) or die (mysql_error());

if($cek)

echo "Data Berhasil Dihapus";

else

echo "GAGAL";

?>

Tampilkan

Script “hapus_hotel.php”

include "../koneksi.php";

$id=$_POST[id];

$no=$_POST[no];

$nama=$_POST[nama];

$telp=$_POST[telp];

$tgl=$_POST[tgl];

$kamar=$_POST[kamar];

$jml=$_POST[jml];

$harga=$_POST[harga];

$total=$_POST[total];

$edit="update reservasi_hotel set nama='$nama',tgl='$tgl',kamar='$kamar',jml='$jml',lama='$lama',harga='$harga',total='$total' where no='$id'";

$cek=mysql_query($edit) or die(mysql_error());

if($cek)

include "tampil_hotel.php";

else

echo "GAGAL";

?>

Tidak ada komentar:

Posting Komentar