Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Freak-kutuonline
1
WP1 – TOKO BUNGA RED FLOWER
Buat database dengan nama dbTokoBunga, kemudian buat tabel orderBunga denga...
Freak-kutuonline
2
Gambar 1. Tampilan input data pemesanan bunga.
Script input_bunga.php
<style type="text/css">
.judul {
...
Freak-kutuonline
3
<td valign="top">ALAMAT PENGIRIMAN</td>
<td><textarea name="alamat" cols="40" rows="3"></textarea>&nbsp...
Freak-kutuonline
4
Ketentuan soal:
1. Pilihan jenis bunga akan menentukan harga bunga.
Jenis bunga Harga bunga
Mawar 15500...
Freak-kutuonline
5
$simpan=mysql_query("INSERT INTO orderBunga VALUES ('',
'$tgl_order',
'$_POST[nama_pemesan]',
'$_POST[a...
Upcoming SlideShare
Loading in …5
×

Web Programming - Toko Bunga Red Flower

4,034 views

Published on

web programming 1 latihan toko bunga red flower

Published in: Education
  • Login to see the comments

Web Programming - Toko Bunga Red Flower

  1. 1. Freak-kutuonline 1 WP1 – TOKO BUNGA RED FLOWER Buat database dengan nama dbTokoBunga, kemudian buat tabel orderBunga dengan spesifikasi tabel seperti berikut. Field Type Length/Size Index Extra No_order Int 5 Primary Auto_Increment Tgl_order Varchar 30 Nama_pemesan Varchar 30 Alamat Varchar 50 Telp Varchar 15 Jenis_bunga Varchar 20 Harga Double Jml_pesan Int 3 Ongkos_kirim Double Total_bayar double Jalankan Dreamweaver, buat file-file berikut. Koneksi.php <?php $host="localhost"; $user="root"; $pass=""; $db="dbTokoBunga"; $Conn=mysql_connect($host,$user,$pass)or die(mysql_error()); mysql_select_db($db,$Conn); ?> Buat tampilan input pemesanan bunga seperti gambar dibawah ini menggunakan komponen Table, simpan dengan nama input_bunga.php.
  2. 2. Freak-kutuonline 2 Gambar 1. Tampilan input data pemesanan bunga. Script input_bunga.php <style type="text/css"> .judul { font-family: "Courier New", Courier, monospace; font-size: 24px; color: #FFF; text-align: center; display: block; background-color: #06F; } </style> </head> <body> <form id="form1" name="form1" method="post" action="simpan_order.php"> <table width="600" border="0" align="center"> <tr> <td colspan="2"><span class="judul">TOKO BUNGA RED FLOWERS</span></td> </tr> <tr> <td width="187">NAMA PEMESAN</td> <td width="397"><input name="nama_pemesan" type="text" size="40" />&nbsp;</td> </tr> <tr>
  3. 3. Freak-kutuonline 3 <td valign="top">ALAMAT PENGIRIMAN</td> <td><textarea name="alamat" cols="40" rows="3"></textarea>&nbsp;</td> </tr> <tr> <td>NO TELP</td> <td><input name="telp" type="text" size="30" />&nbsp;</td> </tr> <tr> <td>JENIS BUNGA</td> <td> <select name="jns_bunga" size="1"> <option>Mawar</option> <option>Anggrek</option> <option>Melati</option> <option>Dahlia</option> <option>Tulip</option> </select> </td> </tr> <tr> <td>JUMLAH PESAN</td> <td><input name="jml_pesan" type="text" size="10" /> &nbsp;/ tangkai</td> </tr> <tr> <td>ONGKOS KIRIM</td> <td><input name="ongkir" type="text" size="30" /></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;*) Cek ongkos kirim via JNE</td> </tr> <tr> <td colspan="2" bgcolor="#0066FF"><div align="right"><input name="submit" type="submit" value="Submit" /><input name="reset" type="reset" value="Reset" /></div></td> </tr> </table> </form> </body>
  4. 4. Freak-kutuonline 4 Ketentuan soal: 1. Pilihan jenis bunga akan menentukan harga bunga. Jenis bunga Harga bunga Mawar 15500 Anggrek 17000 Melati 13000 Dahlia 13500 Tulip 15000 2. Total bayar = (harga * jumlah pesan) + ongkos kirim Selanjutnya buat file simpan_order.php, berikut script file simpan order. <?php include "koneksi.php"; /*---deklarasi variabel yg dibutuhkan---*/ $tgl_order = date ('d F Y'); $jns = $_POST['jns_bunga']; $jml = $_POST['jml_pesan']; $ongkir = $_POST['ongkir']; /*---menentukan harga bunga berdasarkan jenis bunga---*/ if ($jns == 'Mawar') $harga = 15500; else if ($jns == 'Anggrek') $harga = 17000; else if ($jns == 'Melati') $harga = 13000; else if ($jns == 'Dahlia') $harga = 13500; else $harga = 15000; /*---menghitung total bayar---*/ $total = ($harga * $jml) + $ongkir;
  5. 5. Freak-kutuonline 5 $simpan=mysql_query("INSERT INTO orderBunga VALUES ('', '$tgl_order', '$_POST[nama_pemesan]', '$_POST[alamat]', '$_POST[telp]', '$jns', $harga', '$jml', '$_POST[ongkir]', $total')",$Conn); echo "<script>alert('Data order sudah tersimpan.')</script>"; echo "<meta http-equiv='refresh' content='0;url=input_bunga.php'>"; ?> Follow me @AutisPshycophat Facebook.com/devz.andrean

×