Jumat, 25 November 2011

Kisi-Kisi

 MMBUAT DAFTAR HARGA BARANG DENGAN TABEL
-Buka Dream weavers sobat
-Pada Kolom create new klik PHP
-Buatah designnya
-Insert > form  > Form
-Insert > Table di table size buatlah rows nya =5 dan couloumnya=2
-Insert > Form > Text field (4 buah)
-Insert > Form > Button (2 buah)
-Buatlah namanya seperti ini :


-Rubahlah coding php jadi seperti ini :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="form1" method="post" action="uts3.php">
  <table width="309" border="1">
    <tr>
      <td width="135">Kode Barang </td>
      <td width="158"><input type="text" name="kode"></td>
    </tr>
    <tr>
      <td>Nama Barang </td>
      <td><input type="text" name="nama"></td>
    </tr>
    <tr>
      <td>Harga Satuan </td>
      <td><input type="text" name="harga"></td>
    </tr>
    <tr>
      <td>Jumlah Beli </td>
      <td><input type="text" name="jumlah"></td>
    </tr>
    <tr>
      <td><input type="submit" name="Submit" value="Tampilkan"></td>
      <td><input type="submit" name="Submit" value="Submit"></td>
    </tr>
  </table>
</form>
</body>
</html>

-Klik File > save
-Pilih Xampp > htdoc dengan nama file php

-klik File > New > Dinamic page > php
-Jika sudah ada tampilan klik ctrl+a > delete
-Ketiklah koding dibawah ini :
<?
if (isset($_POST['Submit']))
{
$kode=$_POST['kode'];
$nama=$_POST['nama'];
$harga=$_POST['harga'];
$jumlah=$_POST['jumlah'];
$total=$harga*$jumlah;

echo"<table width='300'border='1'>";
echo"<tr>";
echo"<td>";
echo"Kode Barang";
echo"</td>";

echo"<td>";
echo"$kode";
echo"</td>";

echo"</tr>";
echo"</table>";

echo"<table width='300'border='1'>";
echo"<tr>";
echo"<td>";
echo"Nama Barang";
echo"</td>";

echo"<td>";
echo"$nama";
echo"</td>";

echo"</tr>";
echo"</table>";


echo"<table width='300'border='1'>";
echo"<tr>";
echo"<td>";
echo"Harga Barang";
echo"</td>";

echo"<td>";
echo"$harga";
echo"</td>";

echo"</tr>";
echo"</table>";

echo"<table width='300'border='1'>";
echo"<tr>";
echo"<td>";
echo"Jumlah Barang";
echo"</td>";

echo"<td>";
echo"$jumlah";
echo"</td>";

echo"</tr>";
echo"</table>";

echo"<table width='300'border='1'>";
echo"<tr>";
echo"<td>";
echo"Total Harga";
echo"</td>";

echo"<td>";
echo"Rp.$total";
echo"</td>";

echo"</tr>";
echo"</table>";
}
?>
-Klik File > save >xampp >htdoc
-Buka Modzila > dihalaman baru ketik http://localhost/"nama file yang disimpan dihtdoc"
-Enter

-Isilah kolomnya

0 komentar:

Posting Komentar