Senin, 09 Januari 2012

Database Susu Input dan Output

NAMA  : JULIANTO SAPUTRA
NIM      : 18095597
KELAS  : 12.5C.04



LISTING INPUT_SUSU.PHP

<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
       <title>Title here!</title>
</head>
<body bgcolor="blue" text="white">
<form action="output_susu.php" method="post">
<table size=100% border=5><tr><td>
<h1>Toko Susu Sukses Selalu</h1>
<pre>                       
Nama.Pembeli                   :<input type="text" name="nama">
Jenis Susu                            :<select name="kode">
                                                <option value="DCW01">DCW01</option>
                                                  <option value="BND02">BND02</option>
                                                 <option value="NST03">NST03</option></select>
Jumlah               :<input type="text"name="jumlah"> Kaleng <br>
<input type="submit" value="Save"><input type="reset" value="Cancel">

</body>
</html>

TAMPILAN INPUT_SUSU.PHP


LISTING OUTPUT_SUSU.PHP

<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
       <title>Title here!</title>
</head>
<body bgcolor="blue" text="white">
<?
if($kode=="DCW01")
{
    $jenis="Susu Dancow";
    $harga=30000;
}
elseif($kode=="BND02")
{
    $jenis="Susu Bendera";
    $harga=35000;
}
else
{
    $jenis="Susu Nestle";
    $harga=32000;
}
$total=$jumlah*$harga;
$koneksi=mysql_connect("localhost","root","password");
if ($koneksi)
{
    mysql_select_db("latihan_julianto_18095597");
    echo"<pre>";
    echo"<h1>Struk Penjualan Susu</h1>";
    echo"<hr><b>";
    echo"Nama Pembeli        :$nama <br>";
    echo"Jenis Susu          :$jenis<br>";
    echo"Harga               :$harga<br>";
    echo"Jumlah Beli         :$jumlah<br>";
    echo"Total Harga         :$total<br>";
    echo"<hr>";
    $sqlstr="insert into susu values('$nama','$jenis','$jumlah','$harga','$total')";
    $hasil=mysql_query($sqlstr,$koneksi);
    echo"<h1>";
    echo"Sudah Berhasil Disimpan</h1>";
    echo "<table size=100% border=1>";
    echo "<tr><td>Nama.Pembeli</td><td>Jenis.Susu</td><td>Harga</td><td>Jumlah.Beli</td><td>Total.Harga</td></tr>";
    $sqlstr2=mysql_query("select * from susu");
    while ($hasil=mysql_fetch_row($sqlstr2))
    {
        echo"<tr>";
        echo"<td>$hasil[0]</td>";
        echo"<td>$hasil[1]</td>";
        echo"<td>$hasil[2]</td>";
        echo"<td>$hasil[3]</td>";
        echo"<td>$hasil[4]</td>";
        echo"</tr>";
    }
    echo"</table>";
    mysql_close($koneksi);}
    else
    echo "Anda Gagal";
    ?>
    <br>
    <a href="input_susu.php">Lagi</a>
       
</body>
</html>

TAMPILAN OUTPUT_SUSU.PHP


Database Sepatu input dan output

NAMA  : JULIANTO SAPUTRA
NIM       : 18095597
KELAS :12.5C.04


LISTING INPUT-SEPATU.PHP

<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
       <title>Title here!</title>
</head>
<body bgcolor="blue" text="white">
<form action="output_sepatu.php" method="post">
<table size=100% border=5><tr><td>
<h1> Toko Sepatu Futsal  Sport7 </h1>
<pre>
No.Pembelian     :<input type="text" name="no" size=10 maxlength=4><br>
Nama Pembeli     :<input type="text" name="nama" size=10 maxlength=40><br>
Kode Sepatu      :<input type="radio" name="kode" value="AD01">AD01<br>
                          <input type="radio" name="kode" value="NKE02">NKE02<br>
                          <input type="radio" name="kode" value="SPC03">SPC03<br>
Jumlah           :<input type="text" name="jumlah" size=10 maxlength=4><br>
<center><input type="submit"value="Save"><input type="reset" value="Cancel"</center>
</table></tr></td>
</body>
</html>


 HASIL INPUT_SEPATU.PHP




















LISTING OUTPUT-SEPATU.PHP
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
       <title>Title here!</title>
</head>
<body bgcolor="black" text="white">
<table border=5>
<tr><td>
<h1>Struk Pembayaran Pembelian Sepatu Sport7</h1>
<?
require("koneksi.php");
if($kode=="AD01")
{
    $jenis="Adidas";
    $harga=500000;
}
elseif($kode=="NKE02")
{
    $jenis="Nike";
    $harga=450000;
}
else
{
    $jenis="Specs";
    $harga=200000;
}
$total=$jumlah*$harga;
echo"<pre>";
echo"No.Pembelian      :$no<br>";
echo"Nama.Pembeli     :$nama<br>";
echo"Jenis Sepatu        :$jenis<br>";
echo"Harga                  :$harga<br>";
echo"Jumlah                 :$jumlah<br>";
echo"Total                    :$total<br>";
$simpan=mysql_query("insert into sepatu values('$no','$nama','$jenis','$jumlah','$harga','$total')");
if($simpan)
{
    echo"Data sudah berhasil disimpan</h1>";
    echo"</tr></td>";
    echo"<table border=2>";
    echo"<tr><td>No_pembelian</td><td>Nama.Pembeli</td><td>Jenis_sepatu</td><td>Jumlah</td><td>Harga</td><td>Total</td></tr>";
    $sqlstr2=mysql_query("select*from sepatu");
    while($hasil=mysql_fetch_row($sqlstr2))
    {
        echo"<tr>";
        echo"<td>$hasil[0]</td>";
        echo"<td>$hasil[1]</td>";
        echo"<td>$hasil[2]</td>";
        echo"<td>$hasil[3]</td>";
        echo"<td>$hasil[4]</td>";
        echo"<td>$hasil[5]</td>";
        echo"</tr>";
    }
    echo"</table>";
         mysql_close($koneksi);
    }
    else
    echo "Tidak Berhasil";
    ?>
    <a href="input_sepatu.php">Lagi</a>

</body>
</html>



HASIL OUTPUT_SEPATU.PHP



KONEKSIKU.PHP

<?
mysql_connect("localhost","root","password");
mysql_select_db("latihan_julianto_18095597");
?>