Senin, 09 Januari 2012

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");
?>


Tidak ada komentar:

Posting Komentar