Form dan Percabangan

Latihan Form dan Percabangan Pada PHP

 

Form_nilai.php

dengan tampilan sebagai berikut

untitled-6-copy.gif

 

 

 

<!doctype html public “-//W3C//DTD HTML 4.0 //EN”>

<html>

<head>

<title>Entry Data Nilai</title>

</head>

<body bgcolor=blue text=Yellow><table size=50% align=center bgcolor=silver>

<tr><td colspan=4 bgcolor=silver><center><b><h1>DATA NILAI MAHASISWA</h1></b></center></td></tr>

<tr><td colspan=4><hr width=90%></td></tr>

<tr><td colspan=4><form action=form_nilai2.php method=post>

<pre>

<tr><td>NIM </td><td>:</td><td colspan=2><input type=text name=nim></td></tr>

<tr><td>Nama </td><td>:</td><td colspan=2><input type=text name=nama></td></tr>

<tr><td>Kelas </td><td>:</td><td colspan=2><input type=text name=kelas></td></tr>

<tr><td> Masukkan Nilai Tugas </td><td>:</td><td colspan=2> <input type=text name=tugas size=2></td></tr>

<tr><td> Masukkan Nilai UTS </td><td>:</td><td colspan=2> <input type=text name=uts size=2></td></tr>

<tr><td> Masukkan Nilai UAS </td><td>:</td><td colspan=2> <input type=text name=uas size=2></td></tr>

 

<tr><td colspan> <input type=submit value=proses> <input type=reset value=cancel></td></tr>

</pre>

</body>

</html>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Form_nilai2.php

 

 tampilnilai.gif

 

 

<?

$nim=$HTTP_POST_VARS[nim];

$nama=$HTTP_POST_VARS[nama];

$kelas=$HTTP_POST_VARS[kelas];

$tugas=$HTTP_POST_VARS[tugas];

$uts=$HTTP_POST_VARS[uts];

$uas=$HTTP_POST_VARS[uas];

function nilai($n1,$n2,$n3)

{

$rata=($n1+$n2+$n3)/3;

return $rata;

}

$rata=nilai($tugas,$uts,$uas);

echo”<body bgcolor=black>”;

echo”<table width=50% id=table1 bordercolor=red cellpadding=0 cellspacing=0 align=center border=1 bgcolor=white>”;

echo”<tr>

<td rowspan=2 width=15% bgcolor=orange><font color=yellow size=4> ©Ady K™<br> 200603746 <br> </font></td>

<td bgcolor=#FFF3DB><h1 align=center style=’color:black’>OUTPUTAN NILAI MAHASISWA BSI</h1></td>

<td rowspan=2 bgcolor=orange width=15%> <table align=left bgcolor=red><tr><td> </td><td> </td></tr></table><font color=yellow size=4> &nbspDIII.MI <br> &nbsp2006 </td></td>

</tr>”;

echo”<tr>

<td bgcolor=black> </td>

</tr>”;

 

echo”<tr><td colspan=3><hr size=5 width=100% color=blue.></td></tr>”;

echo”<pre>”;

echo”<tr><td colspan=3><font color=blue><b><pre> Nim Mahasiswa : $nim “;

echo”<pre> Nama Mahasiswa : $nama “;

echo”<pre> Kelas : $kelas “;

echo”<pre> Anda Mendapat Nilai : “;

echo”<pre> Tugas : $tugas “;

echo”<pre> UTS : $uts “;

echo”<pre> UAS : $uas “;

if ($rata>=80)

{$grade=”A”;}

elseif ($rata>=70)

{$grade=”B”;}

elseif ($rata>=56)

{$grade=”C”;}

elseif ($rata>=46)

{$grade=”D”;}

else

{$grade=”Maaf Anda Mendapat Grade E”;}

echo”<pre> Dengan Nilai Rata-Rata : $rata “;

echo”<pre> Dengan Grade : $grade</td></tr>”;

echo”<p><div style=’position:absolute; left:10px; width:50px; height:50px; top:430px’>”;

echo”<table bgcolor=lightgreen align=center><tr><td><form action=input.php><input type=submit value=Kembali></td></tr></table></div>”;

?>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Form_order11.php

untitled-2-copy.gif

 

 


<html>

<head>

<title>Biodata Pelanggan</title>

</head>

<?

echo”<body bgcolor=black>”;

echo”<table width=60% id=table1 bordercolor=red cellpadding=0 cellspacing=0 align=center border=1 bgcolor=white>”;

echo”<tr>

<td rowspan=2 width=15% bgcolor=orange><font color=yellow size=4> ©Ady K™<br> 200603746 <br> </font></td>

<td bgcolor=#FFF3DB><h1 align=center style=’color:black’>FORM ORDER SPAREPART COMPUTER</h1></td>

<td rowspan=2 bgcolor=orange width=15%> <table align=left bgcolor=red><tr><td> </td><td> </td></tr></table><font color=yellow size=4> &nbspDIII.MI <br> &nbsp2006 </td></td>

</tr>”;

echo”<tr>

<td bgcolor=black ><font color=white><center><h4>lab A & C Tendean</h4></center></font></td>

</tr>”;

 

echo”<tr><td colspan=3><hr size=5 width=100% color=blue.></td></tr>”;

echo”<pre>”;

echo”<tr><td colspan=3>”;?>

<form method=”post” action=”form_order22.php”>

<pre><br><b>

Nama Pelanggan : <input type=text name=”pelanggan” size=10>

Nama Barang : <input type=Checkbox name=”brg” value=”Harddisk” >Harddisk (Rp.500.000,-)

<input type=Checkbox name=”brg” value=”CDROOM” >CDROM (Rp.300.000,-)

<input type=Checkbox name=”brg” value=”Mouse” >Mouse (Rp.30.000,-)

<input type=Checkbox name=”brg” value=”Printer” >Printer (Rp.400.000,-)

Jumlah Beli : <input type=”text” name=”jumbel” size=2>

Diskon : <input type=”radio” name=”disc” value=”Tidak” unchecked>Tidak Dapat Diskon

<input type=”radio” name=”disc” value=”10%” unchecked>10%

<input type=”radio” name=”disc” value=”20%” unchecked>20%

<hr><localhost/ady/Clock.exe>

<center><input type=submit value=Cetak> <input type=reset value=Batal></center>

</pre>

</table>

</body>

</html>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Form_order22.php

untitled-3-copy.gif

 

<?

$pelanggan=$HTTP_POST_VARS[“pelanggan”];

$jumbel=$HTTP_POST_VARS[“jumbel”];

$brg=$HTTP_POST_VARS[“brg”];

$disc=$HTTP_POST_VARS[“disc”];

$jmlbyr=$HTTP_POST_VARS[“jmlbyr”];

echo”<body bgcolor=black>”;

echo”<table width=60% id=table1 bordercolor=red cellpadding=0 cellspacing=0 align=center border=1 bgcolor=white>”;

echo”<tr>

<td rowspan=2 width=15% bgcolor=orange><font color=yellow size=4> ©Ady K™<br> 200603746 <br> </font></td>

<td bgcolor=#FFF3DB><h1 align=center style=’color:black’>FORM OUTPUT ORDER SPAREPART COMPUTER</h1></td>

<td rowspan=2 bgcolor=orange width=15%> <table align=left bgcolor=red><tr><td> </td><td> </td></tr></table><font color=yellow size=4> &nbspDIII.MI <br> &nbsp2006 </td></td>

</tr>”;

echo”<tr>

<td bgcolor=black ><font color=white><center><h4>lab A & C Tendean</h4></center></font></td>

</tr>”;

 

echo”<tr><td colspan=3><hr size=5 width=100% color=blue.></td></tr>”;

echo”<pre>”;

echo”<tr><td colspan=3>”;

echo”<pre>”;

echo”<div align=center><h2>Toko Computer<br></h2></div>”;

echo”<hr><b> “;

echo” Nama Pelanggan <b> $pelanggan</b><br>”;

 

if($brg==”Harddisk”)

{$harga=500000;

echo” Nama Barang <b> $brg, <br>”;}

elseif($brg==”CDROOM”)

{$harga=300000;

echo” Nama Barang <b> $brg, <br>”;}

elseif($brg==”Mouse”)

{$harga=30000;

echo” Nama Barang <b> $brg, <br>”;}

else

{ $harga=400000;

echo” Nama Barang <b> $brg, <br>”;}

$total=$harga*$jumbel;

echo” Harga Satuan Rp. $harga<br>”;

echo” Jumlah Beli <u> $jumbel buah</u><br>”;

echo” Total Harga Rp. $total<br>”;

 

if($disc==”Tidak”)

{$disc=0*$total;}

elseif($disc==”10%”)

{$disc=0.1*$total;}

else

{$disc=0.2*$total;}

 

echo” Diskon Rp. $disc<br>”;

$kembali=$total-$disc;

echo” Total Pembayaran <b>Rp. $kembali</b><br>”;

$tanggal=date(“d F Y”);

$jam=date(“H:i”);

echo” Dicetak pada tanggal : $tanggal – $jam”;

echo”</pre>”;

?>

<a href=”form_order11.php”>kembali</a>

</table>

</body>

</html>

 

 

 

Form Pendaftaran Kursus

 untitled-4-copy.gif

<!doctype html public “-//W3C//DTD HTML 4.0 //EN”>

<html>

<head>

<title>Formulir Pendaftaran</title>

</head>

<body>

<form action=”datakursus.php” method=”post”>

<pre>

<?

echo”<body bgcolor=black>”;

echo”<table width=60% id=table1 bordercolor=red cellpadding=0 cellspacing=0 align=center border=1 bgcolor=white>”;

echo”<tr>

<td rowspan=2 width=15% bgcolor=orange><font color=yellow size=4> ©Ady K™<br> 200603746 <br> </font></td>

<td bgcolor=#FFF3DB><h1 align=center style=’color:black’>FORMULIR PENDAFTARAN KURSUS</h1></td>

<td rowspan=2 bgcolor=orange width=15%> <table align=left bgcolor=red><tr><td> </td><td> </td></tr></table><font color=yellow size=4> &nbspDIII.MI <br> &nbsp2006 </td></td>

</tr>”;

echo”<tr>

<td bgcolor=black ><font color=white><center><h4>lab A & C Tendean</h4></center></font></td>

</tr>”;

 

echo”<tr><td colspan=3><hr size=5 width=100% color=blue.></td></tr>”;

echo”<tr><td colspan=3>”;

echo”<pre>”;

echo” Tanggal Pendaftaran : “;

echo(date(“d F Y”));

echo”<p>”;

echo” Jenis Paket : <input type=checkbox name=jenis value=Reguler unchecked>Reguler <input type=checkbox name=jenis value=Paket_Khusus unchecked>Paket Khusus”;

echo”<hr>”;

echo” Data Pribadi Siswa<br>”;

echo” Nama Lengkap : <input type=text name=nama size=30><br>”;

echo” Tempat & Tgl Lahir : <input type=text name=tempat>”;

echo”<select name=tgl size=1>”;

 

for ($tgl=1;$tgl<=31;$tgl++)

{echo”<option value=$tgl>$tgl”;}

echo”</select>”;

echo”<select name=bulan size=1>”;

echo”<option value=January>January <option value=February>February<option value=March>March”;

echo”<option value=April>April<option value=May>May<option value=June>June”;

echo”<option value=July>July <option value=August>August<option value=September>September”;

echo”<option value=October>October <option value=November>November<option value=December>December”;

echo”</select>”;

echo”<select name=tahun size=1>”;

 

for ($th=1960;$th<=2000;$th++)

{echo”<option value=$th>$th”;}

echo”</select><br>”;

echo” Alamat : <textarea rows=0 cols=0 wrap=on name=alamat></textarea><br>”;

echo” Kota : <input type=text name=kota><br>”;

echo” Jenis Kelamin : <input type=radio name=kelamin value=Pria checked>Pria<input type=radio name=kelamin value=Wanita checked>Wanita”;

echo”<hr><p>”;

echo” Materi Kursus Yang Diambil<br>

<input type=checkbox name=mata value=Microsoft_Office unchecked>Microsoft Office

<input type=checkbox name=matb value=Microsoft_Visual_Basic unchecked>Microsoft Visual Basic

<input type=checkbox name=matc value=Microsoft_Vox_Pro unchecked>Microsoft Vox_Pro

<input type=checkbox name=matd value=Web_Design unchecked>Web_Design

<input type=checkbox name=mate value=Value_Plus unchecked>Value_Plus

<input type=checkbox name=matf value=Photoshop unchecked>Photoshop

<input type=checkbox name=matg value=Design_Grafis unchecked>Design_Grafis”;

echo”<p>”;

echo” <input type=submit value=Kirim Data> <input type=reset value=Batal>”;

echo”<marquee behavior=alternate>Terima Kasih Atas Pendaftarannya</marquee>”;

?>

</body>

</html>

 

 

Form outputnya

untitled-5-copy.gif

 

 

<!doctype html public “-//W3C//DTD HTML 4.0 //EN”>

<html>

<head>

<title>Title here!</title>

</head>

<body>

<?

$nama=$HTTP_POST_VARS[“nama”];

$tempat=$HTTP_POST_VARS[“tempat”];

$tgl=$HTTP_POST_VARS[“tgl”];

$bulan=$HTTP_POST_VARS[“bulan”];

$tahun=$HTTP_POST_VARS[“tahun”];

$alamat=$HTTP_POST_VARS[“alamat”];

$kota=$HTTP_POST_VARS[“kota”];

$kelamin=$HTTP_POST_VARS[“kelamin”];

$materi1=$HTTP_POST_VARS[“mata”];

$materi2=$HTTP_POST_VARS[“matb”];

$materi3=$HTTP_POST_VARS[“matc”];

$materi4=$HTTP_POST_VARS[“matd”];

$materi5=$HTTP_POST_VARS[“mate”];

$materi6=$HTTP_POST_VARS[“matf”];

$materi7=$HTTP_POST_VARS[“matg”];

$jenis=$HTTP_POST_VARS[“jenis”];

echo”<body bgcolor=black>”;

echo”<table width=60% id=table1 bordercolor=red cellpadding=0 cellspacing=0 align=center border=1 bgcolor=white>”;

echo”<tr>

<td rowspan=2 width=15% bgcolor=orange><font color=yellow size=4> ©Ady K™<br> 200603746 <br> </font></td>

<td bgcolor=#FFF3DB><h1 align=center style=’color:black’>DAFTAR SISWA PESERTA KURSUS</h1></td>

<td rowspan=2 bgcolor=orange width=15%> <table align=left bgcolor=red><tr><td> </td><td> </td></tr></table><font color=yellow size=4> &nbspDIII.MI <br> &nbsp2006 </td></td>

</tr>”;

echo”<tr>

<td bgcolor=black ><font color=white><center><h4>lab A & C Tendean</h4></center></font></td>

</tr>”;

 

echo”<tr><td colspan=3><hr size=5 width=100% color=blue.></td></tr>”;

 

echo”<tr><td colspan=3><pre>”;

echo” Jenis Paket Kursus Yang di ambil : $jenis<br>”;

echo” Nama Lengkap : <b>$nama</b><br>”;

echo” Tempat & Tgl Lahir : <b>$tempat $tgl $bulan $tahun</b><br>”;

echo” Alamat : <b>$alamat</b><br>”;

echo” Kota : <b>$kota</b><br>”;

echo” Jenis Kelamin : <b>$kelamin</b><br>”;?>

Mater Yang Diambil :<?

$mat=array($materi1,$materi2,$materi3,$materi4,$materi5,$materi6,$materi7);

for($c=0;$c<=6;$c++)

{ if($mat[$c]!=””)

echo” <b>$mat[$c],</b> “;}

echo”<p>”;

echo”<center>* Anda Telah Melakukan Regristrasi *<br>”;

?>

<a href=”form_kursus.php” >kembali</a></center>

</table>

</body>

</html>

Satu Tanggapan

  1. Saya tertarik dengan form omm d sini. omm form buat daftar siswa baru gimana ya kasih tau donk TA buat form daftar siswa tapi gak ngerti sama sekali kalo boleh aku minta tolong kirimi ke email formnya aja ya omm. thanks

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: