<html>
<head>
<style type=text/css>
B {color:blue; font-style:italic;text-decoration:line-through}
</style>
</head>
<body>
<B>Penjualan Pernak Pernik Online</B>
<pre>
<form method=post action=jadi.php>
Nama : <input type=text name=nama>
Email : <input type=text name=email>
Hadiah : <input type=radio name=hadiah value=Boneka>Boneka
<input type=radio name=hadiah value=Bunga >Bunga
<input type=radio name=hadiah value=Baju >Baju
<input type=radio name=hadiah value=Pita >Pita
Warna : <select name=warna>
<?php
$d=array(5=>"Biru","Kuning","Merah","Hitam","Putih");
for($x=5;$x<=9;$x++)
{
echo "<option value=$d[$x]>$d[$x]";
}
?>
</select>
<input type=submit value=Pesan>
</form>
<form method=post action=search.php>
<input type=text name=nama>
<input type=submit value=search>
</form>
</pre>
</body>
</html>
jadi.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<?php
$nama =$_POST['nama'];
$email =$_POST['email'];
$hadiah =$_POST['hadiah'];
$warna =$_POST['warna'];
mysql_connect("localhost","root","");
mysql_select_db("db12a3_19") or die("Database Not Found");
$hsl=mysql_query("insert into coba(nama,email,hadiah,warna) values ('$nama','$email','$hadiah','$warna')");
$d=mysql_query("select * from coba where hadiah='Boneka'");
$bo=mysql_num_rows($d);
$d=mysql_query("select * from coba where hadiah='Bunga'");
$bu=mysql_num_rows($d);
$d=mysql_query("select * from coba where hadiah='Baju'");
$ba=mysql_num_rows($d);
$d=mysql_query("select * from coba where hadiah='Pita'");
$pi=mysql_num_rows($d);
$tot=$bo+$bu+$ba+$pi;
$hsl=mysql_query("select * from coba");
while($d=mysql_fetch_array($hsl))
{
echo "<pre>";
echo "Nama : $d[nama] <br>";
echo "Email : $d[email] <br>";
echo "Hadiah : $d[hadiah] <br>";
echo "Warna : $d[warna] <br>";
}
echo "Banyak orang yang suka Boneka : ". $bo/$tot*100 ."%<br>";
echo "Banyak orang yang suka Bunga : ". $bu/$tot*100 ."%<br>";
echo "Banyak orang yang suka Baju : ". $ba/$tot*100 ."%<br>";
echo "Banyak orang yang suka Pita : ". $pi/$tot*100 ."%<br>";
?>
<body>
</body>
</html>
search.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<?php
$nama=$_POST['nama'];
mysql_connect("localhost","root","");
mysql_select_db("db12a3_19") or die("Database Not Found");
$hasil=mysql_query("select * from coba where nama like '%$nama%'");
while($d=mysql_fetch_array($hasil))
{
echo "Nama : $d[nama] <br>";
echo "Email : $d[email] <br>";
echo "Hadiah : $d[hadiah] <br>";
echo "Warna : $d[warna] <br>";
}
?>
<body>
</body>
</html>
Rek, nie filenya memang bisa disingkat jd 2 file doank tp lbh njelimet yg mw tau hub q ajh...