Minggu, 24 Maret 2013

Pemograman WEB


FORM INPUT

<html>
<head>
<title>Data Barang</title>
</head>
<body>
<h2>Input Data Barang</h2>
<form action="hasil_input.php" method="post">
<table>
<tr>
<tr>
<td>Kode Masuk</td>
<td>: <input type="text" name="kode_masuk" size="11"></td>
</tr>
<tr>
<td>Kode Barang</td>
<td>: <input type="text" name="kode_barang" size="20"></td>
</tr>
<tr>
<td>Tanggal Masuk</td>
<td>: <input type="text" name="tanggal_masuk" size="20"></td>
</tr>
<tr>
<td>Jumlah Barang</td>
<td>: <input type="text" name="jumlah_barang" size="11"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="send" value="Send">
<input type="reset" name="clear" value="Clear">
</td>
</tr>
</table>
</form>
</body>
</html>

HASIL INPUT


<html>
<head>
<title>Data Barang</title>
</head>
<body>
<h2>Input Data Barang</h2>
<?php
$kode_masuk=$_POST['kode_masuk'];
$kode_barang=$_POST['kode_barang'];
$tanggal_masuk=$_POST['tanggal_masuk'];
$jumlah_barang=$_POST['jumlah_barang'];

$host ="localhost";
$user ="root";
$paswd="";
$db ="dbgoku";

$idkoneksi=@mysql_connect($host,$user,$paswd) or
die("Koneksi dengan <b>Server MySQL</b> tidak berhasil !");
$iddatabase=@mysql_select_db($db);

$sqlstr="insert into tbarang
(kode_masuk,kode_barang,tanggal_masuk,jumlah_barang)values

('$kode_masuk','$kode_barang','$tanggal_masuk','$jumlah_barang')";
$hasil=@mysql_query($sqlstr,$idkoneksi);
if($hasil)
{
echo("Data berhasil disimpan !<br>");
}else
{
echo("Data gagal disimpan !<br>");
}
@mysql_close($idkoneksi);
?>
<br><a href="form_input.html">Kembali</a>
</body>
</html>

DAFTAR BARANG

<html>
<head>
<title>Data Barang</title>
</head>
<body>
<h2>Daftar Barang</h2>
<table width="500" border="0" cellpadding="0" cellspacing="1"
bgcolor="#CCCCCCC">
<tr bgcolor="#999999">
<th><font color="#FFFFFF">Kode Masuk</font></th>
<th><font color="#FFFFFF">Kode Barang</font></th>
<th><font color="#FFFFFF">Tanggal Masuk</font></th>
<th><font color="#FFFFFF">Jumlah Barang</font></th>
</tr>
<?php
$host ="localhost";
$user ="root";
$paswd="";
$db ="dbgoku";

$idkoneksi=@mysql_connect($host,$user,$paswd) or
die("Koneksi dengan <b>Server MySQL</b> tidak berhasil !");
$iddatabase=@mysql_select_db($db);

$sqlstr="select * from tbarang";
$hasil=@mysql_query($sqlstr,$idkoneksi);

while($row=mysql_fetch_array($hasil))
{
?>
<tr bgcolor="#FFFFFF">
<td><?php echo $row["kode_masuk"]; ?></td>
<td><?php echo $row["kode_barang"]; ?></td>
<td><?php echo $row["tanggal_masuk"]; ?></td>
<td><?php echo $row["jumlah_barang"]; ?></td>
<?php
}
@mysql_close($idkoneksi);
?>
</tr>
</table>
</body>
</html>

UPDATE BARANG

<html>
<head>
<title>Data Barang</title>
</head>
<body>
<h2>Update Data Barang</h2>
<?php
$kode_masuk=$_GET['kode_masuk'];

$host ="localhost";
$user ="root";
$paswd="";
$db ="dbgoku";

$idkoneksi=@mysql_connect($host,$user,$paswd) or
die("Koneksi dengan <b>Server MySQL</b> tidak berhasil !");
$iddatabase=@mysql_select_db($db);

$sqlstr="select * from tbarang where kode_masuk='$kode_masuk'";
$hasil=@mysql_query($sqlstr,$idkoneksi);
$row=mysql_fetch_array($hasil);
?>
<form action="hasil_update.php" method="post">
<table>
<tr>
<td>Kode Masuk</td>
<td>: <input type="text" name="kode_masuk" size="11" value="<?php echo
$row['kode_masuk']; ?>" readonly="true"></td>
</tr>
<tr>
<td>Kode Barang</td>
<td>: <input type="text" name="kode_barang" size="20" value="<?php echo
$row['kode_barang']; ?>"></td>
</tr>
<tr>
<td>Tanggal Masuk</td>
<td>: <input type="text" name="tanggal_masuk" size="20" value="<?php echo
$row['tanggal_masuk']; ?>"></td>
</tr>
<tr>
<td>Jumlah Barang</td>
<td>: <input type="text" name="jumlah_barang" size="11" value="<?php echo
$row['jumlah_barang']; ?>"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="send" value="Send">
<input type="reset" name="clear" value="Clear"></td>
<?php

@mysql_close($idkoneksi);
?>
</tr>
</table>
</form>
</body>
</html>

HASIL UPDATE

<html>
<head>
<title>Data Barang</title>
</head>
<body>
<h2>Update Data Barang</h2>
<?php
$kode_masuk=$_POST['kode_masuk'];
$kode_barang=$_POST['kode_barang'];
$tanggal_masuk=$_POST['tanggal_masuk'];
$jumlah_barang=$_POST['jumlah_barang'];

$host ="localhost";
$user ="root";
$paswd="";
$db ="dbgoku";

$idkoneksi=@mysql_connect($host,$user,$paswd) or
die("Koneksi dengan <b>Server MySQL</b> tidak berhasil !");
$iddatabase=@mysql_select_db($db);

$sqlstr="update tbarang set
kode_barang='$kode_barang',
tanggal_masuk='$tanggal_masuk',
jumlah_barang='$jumlah_barang'
where
kode_masuk='$kode_masuk'";

$hasil=@mysql_query($sqlstr,$idkoneksi);
if($hasil)
{
echo("Update Data berhasil disimpan !<br>");
}else
{
echo("Update Data gagal disimpan !<br>");
}
@mysql_close($idkoneksi);
?>
<br><a href="daftar_update.php">Daftar Barang</a>
</body>
</html>

DAFTAR UPDATE

<html>
<head>
<title>Data Barang</title>
</head>
<body>
<h2>Daftar Data Barang</h2>
<table width="500" border="0" cellpadding="0" cellspacing="1"
bgcolor="#CCCCCCC">
<tr bgcolor="#999999">
<th><font color="#FFFFFF">Kode Masuk</font></th>
<th><font color="#FFFFFF">Kode Barang</font></th>
<th><font color="#FFFFFF">Tanggal Masuk</font></th>
<th><font color="#FFFFFF">Jumlah Barang</font></th>
</tr>
<?php
$host ="localhost";
$user ="root";
$paswd="";
$db ="dbgoku";

$idkoneksi=@mysql_connect($host,$user,$paswd) or
die("Koneksi dengan <b>Server MySQL</b> tidak berhasil !");
$iddatabase=@mysql_select_db($db);

$sqlstr="select * from tbarang";
$hasil=@mysql_query($sqlstr,$idkoneksi);
while($row=mysql_fetch_array($hasil))
{
?>
<tr bgcolor="#FFFFFF">
<td><?php echo $row["kode_masuk"]; ?></td>
<td><?php echo $row["kode_barang"]; ?></td>
<td><?php echo $row["tanggal_masuk"]; ?></td>
<td><?php echo $row["jumlah_barang"]; ?></td>
<td><a href="update_barang.php?kode_masuk=<?php echo
$row["kode_masuk"]; ?>">Edit</a></td>
<?php
}
@mysql_close($idkoneksi);
?>
</tr>
</table>
</body>
</html>

DAFTAR BARANG DELETE

<html>
<head>
<title>Data Barang</title>
</head>
<body>
<h2>Daftar Data Barang</h2>
<table width="500" border="0" cellpadding="0" cellspacing="1"
bgcolor="#CCCCCCC">
<tr bgcolor="#999999">
<th><font color="#FFFFFF">Kode Masuk</font></th>
<th><font color="#FFFFFF">Kode Barang</font></th>
<th><font color="#FFFFFF">Tanggal Masuk</font></th>
<th><font color="#FFFFFF">Jumlah Barang</font></th>
<th></th>
</tr>
<?php
$host ="localhost";
$user ="root";
$paswd="";
$db ="dbgoku";

$idkoneksi=@mysql_connect($host,$user,$paswd) or
die("Koneksi dengan <b>Server MySQL</b> tidak berhasil !");
$iddatabase=@mysql_select_db($db);

$sqlstr="select * from tbarang";
$hasil=@mysql_query($sqlstr,$idkoneksi);
while($row=mysql_fetch_array($hasil))
{
?>
<tr bgcolor="#FFFFFF">
<td><?php echo $row["kode_masuk"]; ?></td>
<td><?php echo $row["kode_barang"]; ?></td>
<td><?php echo $row["tanggal_masuk"]; ?></td>
<td><?php echo $row["jumlah_barang"]; ?></td>
<td><a href="hasil_delete.php?kode_masuk=<?php echo $row["kode_masuk"];
?>">Delete</a></td>
<?php
}
@mysql_close($idkoneksi);
?>
</tr>
</table>
</body>
</html>

HASIL DELETE

<html>
<head>
<title>Data Barang</title>
</head>
<body>
<h2>Delete Data Barang</h2>
<?php
$kode_masuk=$_GET['kode_masuk'];
$host ="localhost";
$user ="root";
$paswd="";
$db ="dbgoku";

$idkoneksi=@mysql_connect($host,$user,$paswd) or
die("Koneksi dengan <b>Server MySQL</b> tidak berhasil !");
$iddatabase=@mysql_select_db($db);

$sqlstr="delete from tbarang where kode_masuk='$kode_masuk'";
$hasil=@mysql_query($sqlstr,$idkoneksi);
if($hasil)
{
echo("Data berhasil dihapus !<br>");
}else
{
echo("Data gagal dihapus !<br>");
}
@mysql_close($idkoneksi);
?>
<br><a href="daftar_barang_delet.php">Daftar Barang</a>
</body>
</html>

FRAME 1

<html>
<head>
<title>Data Barang</title>
</head>
<body>
<h2>Daftar Data Barang</h2>
<table width="500" border="0" cellpadding="0" cellspacing="1"
bgcolor="#CCCCCCC">
<tr bgcolor="#999999">
<th><font color="#FFFFFF">Kode Masuk</font></th>
<th><font color="#FFFFFF">Kode Barang</font></th>
<th><font color="#FFFFFF">Tanggal Masuk</font></th>
<th><font color="#FFFFFF">Jumlah Barang</font></th>
</tr>
<?php
$host ="localhost";
$user ="root";
$paswd="";
$db ="dbgoku";

$idkoneksi=@mysql_connect($host,$user,$paswd) or
die("Koneksi dengan <b>Server MySQL</b> tidak berhasil !");
$iddatabase=@mysql_select_db($db);

$sqlstr="select * from tbarang";
$hasil=@mysql_query($sqlstr,$idkoneksi);
while($row=mysql_fetch_array($hasil))
{
?>
<tr bgcolor="#FFFFFF">
<td><?php echo $row["kode_masuk"]; ?></td>
<td><?php echo $row["kode_barang"]; ?></td>
<td><?php echo $row["tanggal_masuk"]; ?></td>
<td><?php echo $row["jumlah_barang"]; ?></td>
<td><a href="update_barang.php?kode_masuk=<?php echo
$row["kode_masuk"]; ?>">Edit</a></td>
<td><a href="hasil_delete.php?kode_masuk=<?php echo $row["kode_masuk"];
?>">Delete</a></td>
<?php
}
@mysql_close($idkoneksi);
?>
</tr>
</table>
</body>
</html>

FRAME GABUNGAN

<html>
<head><title>Data Masuk Barang</title></head>
<frameset cols="30%,*">
<frame src="no_2.html" name="frm_kiri"/>
<frame src="daftar_databarang.php" name="frm_kanan"/>
<noframes>
<body>
<p><a href="no_2.html">DAFTAR DATA BARANG</a></p>
</body>
</noframes>
</frameset>
</html>











Tidak ada komentar: