Script untuk input.php ( Form Input )
<html>
<head><title>Pengolahan Form</title></head>
<body>
<FORM ACTION="proses.php" METHOD="POST"
NAME="input">
Nama Anda : <input type="text"
name="nama"><br>
<h2>Pilih Jurusan Anda :</h2>
<input type="radio" name="jurusan"
value="TI" checked>Teknik Informatika<br>
<input type="radio" name="jurusan"
value="SI">Sistem Informasi<br>
<input type="radio" name="jurusan"
value="SK">Sistem Komputer<br>
<input type="radio" name="jurusan"
value="KA">Komputerisasi Akuntansi<br>
<h2>Pilih Band Favorit Anda :</h2>
<input type="checkbox" name="band01"
value="Padi" checked> Padi<br>
<input type="checkbox" name="band02"
value="Sheila On 7"> Sheila On 7<br>
<input type="checkbox" name="band03"
value="Dewa 19"> Dewa 19<br>
<input type="checkbox" name="band04"
value="Ungu"> Ungu<br>
<h2>Pilih Film Kartun Favorit Anda :</h2>
<select name="kartun">
<option value="Sponge Bob">Sponge Bob</option>
<option value="Sinchan">Sinchan</option>
<option value="Conan">Conan</option>
<option value="Doraemon">Doraemon</option>
<option value="Dragon Ball">Dragon Ball</option>
<option value="Naruto">Naruto</option>
</select>
<input type="submit" name="Input"
value="Input">
</FORM>
</body>
</html>
|
Script untuk proses.php ( Form Proses dan Out
Put )
<?php
if (isset($_POST['Input'])) {
$nama = $_POST['nama'];
echo "Nama Anda :
<b>$nama</b><br><br>";
}
{
$jurusan = $_POST['jurusan'];
echo "Jurusan Anda adalah
<b><font
color='red'>$jurusan</font></b><br><br>";
}
{
echo "Band Favorit Anda adalah :<br>";
if (isset($_POST['band01'])) {
echo "+ " . $_POST['band01'] .
"<br>";
}
if (isset($_POST['band02'])) {
echo "+ " . $_POST['band02'] .
"<br>";
}
if (isset($_POST['band03'])) {
echo "+ " . $_POST['band03'] .
"<br>";
}
if (isset($_POST['band04'])) {
echo "+ " . $_POST['band04'] .
"<br><br>";
}
} {
$film = $_POST['kartun'];
echo "Film Kartun Favorit Anda adalah :
<font
color=blue><b>$film</b></font>";
}
?>
|