Praktikum 7.1
Ketik kode berikut dan simpan dengan nama login.php pada root direktori web server.
<?php
session_start();
if ( isset( $_POST["login"]) ) {
login();
} elseif ( isset ( $_GET["action"]) and $_GET["action"] == "logout") {
logout();
}elseif ( isset ( $_SESSION["username"])) {
displayPage();
}else{
displayLoginForm();
}
function login(){
$username = "willy";
$passwd = "willy";
if (isset ( $_POST["username"]) and isset ($_POST["password"])) {
echo $_POST ["username"];
if ($_POST["username"] == $username and $_POST["password"] == $passwd ){
$_SESSION["username"] = $username;
session_write_close();
header("Location : login.php");
}else{
displayLoginForm ("username/password Tidak cocok");
}
}
}
function logout(){
unset($_SESSION["username"]);
session_write_close();
header("Location: login.php");
}
function displayPage(){
displayPageHeader();
?>
<p>Welcome, <strong><?php echo $SESSION["username"] ?></strong> Anda sudah Berhasil Login.</p>
<p><a href="login.php?action=logout">Logout</a></p>
</body>
</html>
<?php
}
function displayLoginForm($message=""){
displayPageHeader();
?>
<?php if($message)
echo '<p class="error">' . $message . '</p>';
?>
<center>
<form action="login.php" method="post">
<div style= "width: 30em;">
<label for = "username">Username</label>
<input type="text" name="username" id="username" value=""/><br>
<label for="password">Password</label>
<input type="password" name="password" id="password" value=""/>
<div style="clear: both;">
<input type="submit" name="login" value="Login" />
</div>
</div>
</center>
</form>
</body>
</html>
<?php
}
function displayPageHeader(){
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="on" lang="on">
<head>
<title> A Login Form</title>
<link rel="stylesheet" type="text/css" href="common.css" />
<style type="text/css">
.error{ background: #d33; color: white; padding: 0.2em; }
</style>
</head>
<body>
<h1>Silahkan Login</h1>
<?php
}
?>
Ketik kode berikut dan simpan dengan nama common.css pada root direktori web server
/*Page Body */
body {font-family : Arial,helvetia,sans-serif;}
/*definition lists*/
dl {
width:100%;
margin:2em 0;
padding: 0;
clear: both;
overflow:auto;
}
dt {
width:30%;
float : left ;
margin:0;
padding: 5px 9.9% 5px 0; 0
order-top:1px solid #DDDDB7;
font-weight:bold;
overflow:auto;
clear:left;
}
dd {
width : 60%;
float :left;
margin:0;
padding:6px 0 5px 0;
border-top:1px solid #DDDDB7;
overflow:auto;
}
/*headings*/
h1{
font-weight:bold;
margin:35px 0 14px;
color:#666;
font-size:1.5em;
}
h2{
font-weight:bold;
margin:30px 0 12px;
color:#666;
font-size:1.3em;
}
h3{
font-weight:normal;
margin:30px 0 12px;
color:#666;
font-size:1.2em;
}
h4{
font-weight:bold;
margin:25px 0 12px;
color:#666;
font-size:1.0em;
}
h5{
font-weight:bold;
margin:25px 0 12px;
color:#666;
font-size:0.9em;
}
/*form*/
label { display:block;
float:left;
clear:both;
text-align:right;
margin:0.6em 5px 0 0;
width: 40%;
}
input,select,textarea {
float:right;
margin:1em 0 0 0;
width:57%;
}
input {
border:1px solid #666;
}
input[type=radio], iinput[type=checkbox],input[type=submit],input[type=reset],input[type=button],input[type=image]{
width:auto;
}
maka username dan password akan muncul seperti ini:
Minggu, 27 Mei 2012
Senin, 14 Mei 2012
Laporan Praktikum PBW 6
Praktikum 6.1
Buat form registrasi dengan nama form-registrasi.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="on" lang="on">
<head>
<tittle>Membership Form</tittle>
<link rel="stylesheet" type="text/css" href="common.css" />
<!--common.cs merupakan code dari buku Beginning PHP 5.3-->
</head>
<body>
<h1>Formulir Pendaftaran</h1>
<form action="registrasi2.php" method ="POST">
<div style ="width:30 cm;">
<label for ="nama">Nama</label>
<input type ="text" name ="nama" id="nama" value = ""/>
<label for = "nim">N I M</label>
<input type="text" name ="nim" id ="nim" value ="" />
<label for = "password1">Password</label>
<input type="password" name ="password1" id ="password1" value ="" />
<label for ="laki-laki">Apakah Anda Laki-Laki...</label>
<input type="radio" name="jk" id="Laki-Laki" value ="Laki-Laki"/>
<label for="perempuan">...atau perempuan?</label>
<input type="radio" name="jk" id="perempuan" value="perempuan"/>
<label for ="paket">paket yang anda pilih?</label>
<select name="paket" id="favoriteWidget" size="1">
<option value="platinum">Paket Platinum</option>
<option value="gold">Paket Gold</option>
<option value="silver">Paket Silver</option>
</select>
<input type="submit" name="daftar" id="daftar" value="Daftar"/>
</div>
</form>
</body>
</html>
Buat css untuk mengatur ukuran formnya dengan nama common.css:
/*Page Body */
body {font-family : Arial,helvetia,sans-serif;}
/*definition lists*/
dl {
width:100%;
margin:2em 0;
padding: 0;
clear: both;
overflow:auto;
}
dt {
width:30%;
float : left ;
margin:0;
padding: 5px 9.9% 5px 0; 0
order-top:1px solid #DDDDB7;
font-weight:bold;
overflow:auto;
clear:left;
}
dd {
width : 60%;
float :left;
margin:0;
padding:6px 0 5px 0;
border-top:1px solid #DDDDB7;
overflow:auto;
}
/*headings*/
h1{
font-weight:bold;
margin:35px 0 14px;
color:#666;
font-size:1.5em;
}
h2{
font-weight:bold;
margin:30px 0 12px;
color:#666;
font-size:1.3em;
}
h3{
font-weight:normal;
margin:30px 0 12px;
color:#666;
font-size:1.2em;
}
h4{
font-weight:bold;
margin:25px 0 12px;
color:#666;
font-size:1.0em;
}
h5{
font-weight:bold;
margin:25px 0 12px;
color:#666;
font-size:0.9em;
}
/*form*/
label { display:block;
float:left;
clear:both;
text-align:right;
margin:0.6em 5px 0 0;
width: 40%;
}
input,select,textarea {
float:right;
margin:1em 0 0 0;
width:57%;
}
input {
border:1px solid #666;
}
input[type=radio], iinput[type=checkbox],input[type=submit],input[type=reset],input[type=button],input[type=image]{
width:auto;
}
Buat file untuk menampilkan isi dari form-registrasi.html,degan nama registrasi.php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="on" lang="on">
<head>
<title>Membership Form</title>
<link rel="stylesheet" type="text/css" href="common.css" />
</head>
<body>
<h1>Anda Telah Terdaftar</h1>
<p>Berikut adalah data anda:</p>
<dl>
<dt>Nama Anda </dt><dd><?php echo $_POST["nama"]?></dd>
<dt>NIM</dt><dd><?php echo $_POST["nim"]?></dd>
<dt>Password</dt><dd><?php echo $_POST["password"]?></dd>
<dt>Jenis Kelamin</dt><dd><?php echo $_POST["jk"]?></dd>
<dt>Paket yang anda Pilih</dt><dd><?php echo $_POST["paket"]?></dd>
</dl>
</body>
</html>
Praktikum 6.2
Tambahkankan Password & Konfirmaasi password.jika password dan konfirmasi password tidak sama,maka muncul message box "Password tidak sama".code nya sebagai berikut :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="on" lang="on">
<head>
<tittle>Membership Form</tittle>
<link rel="stylesheet" type="text/css" href="common.css" />
<!--common.cs merupakan code dari buku Beginning PHP 5.3-->
</head>
<body>
<h1>Formulir Pendaftaran</h1>
<form action="registrasi2.php" method ="POST">
<div style ="width:30 cm;">
<label for ="nama">Nama</label>
<input type ="text" name ="nama" id="nama" value = ""/>
<label for = "nim">N I M</label>
<input type="text" name ="nim" id ="nim" value ="" />
<label for = "password1">Password</label>
<input type="password" name ="password1" id ="password1" value ="" />
<label for = "password2">Konfirmasi Password</label>
<input type="password" name ="password2" id ="password2" value ="" />
<label for ="laki-laki">Apakah Anda Laki-Laki...</label>
<input type="radio" name="jk" id="Laki-Laki" value ="Laki-Laki"/>
<label for="perempuan">...atau perempuan?</label>
<input type="radio" name="jk" id="perempuan" value="perempuan"/>
<label for ="paket">paket yang anda pilih?</label>
<select name="paket" id="favoriteWidget" size="1">
<option value="platinum">Paket Platinum</option>
<option value="gold">Paket Gold</option>
<option value="silver">Paket Silver</option>
</select>
<input type="submit" name="daftar" id="daftar" value="Daftar"/>
</div>
</form>
</body>
</html>
Jika tidak sama maka akan muncul sebagai berikut
Membuat code dengan form-registrasi html 5,jika ada field yang tidak di isi maka akan di beri tahu:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="on" lang="on">
<head>
<tittle>Membership Form</tittle>
<link rel="stylesheet" type="text/css" href="common.css" />
<!--common.cs merupakan code dari buku Beginning PHP 5.3-->
</head>
<body>
<h1>Formulir Pendaftaran</h1>
<form action="registrasi2.php" method ="POST">
<div style ="width:30 cm;">
<label for ="nama">Nama</label>
<input type ="text" name ="nama" id="nama" value = "" required = 'required'/>
<label for = "nim">N I M</label>
<input type="text" name ="nim" id ="nim" value ="" required = 'required' />
<label for = "password1">Password</label>
<input type="password" name ="password1" id ="password1" value ="" required = 'required'/>
<label for = "password2">Konfirmasi Password</label>
<input type="password" name ="password2" id ="password2" value ="" required = 'required' />
<label for ="laki-laki">Apakah Anda Laki-Laki...</label>
<input type="radio" name="jk" id="Laki-Laki" value ="Laki-Laki" required = 'required'/>
<label for="perempuan">...atau perempuan?</label>
<input type="radio" name="jk" id="perempuan" value="perempuan" required = 'required'/>
<label for ="paket">paket yang anda pilih?</label>
<select name="paket" id="favoriteWidget" size="1">
<option value="platinum">Paket Platinum</option>
<option value="gold">Paket Gold</option>
<option value="silver">Paket Silver</option>
</select>
<input type="submit" name="daftar" id="daftar" value="Daftar"/>
</div>
</form>
</body>
</html>
Menambahkan Field e-mail pada form-registrasi.html kemudian dimunculkan pada registrasi.php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="on" lang="on">
<head>
<tittle>Membership Form</tittle>
<link rel="stylesheet" type="text/css" href="common.css" />
<!--common.cs merupakan code dari buku Beginning PHP 5.3-->
</head>
<body>
<h1>Formulir Pendaftaran</h1>
<form action="registrasi3.php" method ="POST">
<div style ="width:30 cm;">
<label for ="nama">Nama</label>
<input type ="text" name ="nama" id="nama" value = "" required = 'required'/>
<label for = "nim">N I M</label>
<input type="text" name ="nim" id ="nim" value ="" required = 'required' />
<label for = "password1">Password</label>
<input type="password" name ="password1" id ="password1" value ="" required = 'required'/>
<label for = "password2">Konfirmasi Password</label>
<input type="password" name ="password2" id ="password2" value ="" required = 'required' />
<label for = "email">E-Mail</label>
<input type="text" name ="email" id ="email" value ="" required = 'required' />
<label for ="laki-laki">Apakah Anda Laki-Laki...</label>
<input type="radio" name="jk" id="Laki-Laki" value ="Laki-Laki" required = 'required'/>
<label for="perempuan">...atau perempuan?</label>
<input type="radio" name="jk" id="perempuan" value="perempuan" required = 'required'/>
<label for ="paket">paket yang anda pilih?</label>
<select name="paket" id="favoriteWidget" size="1">
<option value="platinum">Paket Platinum</option>
<option value="gold">Paket Gold</option>
<option value="silver">Paket Silver</option>
</select>
<input type="submit" name="daftar" id="daftar" value="Daftar"/>
</div>
</form>
</body>
</html>
code registrasi.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="on" lang="on">
<head>
<title>Membership Form</title>
<link rel="stylesheet" type="text/css" href="common.css" />
</head>
<body>
<?php
if ($_POST["password1"] != $_POST["password2"]){
echo "<script>alert ('password tidak sama ');</script>";
}
else
{?>
<h1>Anda Telah Terdaftar</h1>
<p>Berikut adalah data anda:</p>
<dl>
<dt>Nama Anda </dt><dd><?php echo $_POST["nama"]?></dd>
<dt>NIM</dt><dd><?php echo $_POST["nim"]?></dd>
<?php if (($_POST["password1"])== $_POST["password2"]){?>
<dt>Password</dt><dd><?php echo $_POST["password"]?></dd>
<?php } ?>
<dt>E-Mail</dt><dd><?php echo $_POST["email"] ?> </dd>
<dt>Jenis Kelamin</dt><dd><?php echo $_POST["jk"]?></dd>
<dt>Paket yang anda Pilih</dt><dd><?php echo $_POST["paket"]?></dd>
</dl>
<?php } ?>
</body>
</html>
Buat form registrasi dengan nama form-registrasi.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="on" lang="on">
<head>
<tittle>Membership Form</tittle>
<link rel="stylesheet" type="text/css" href="common.css" />
<!--common.cs merupakan code dari buku Beginning PHP 5.3-->
</head>
<body>
<h1>Formulir Pendaftaran</h1>
<form action="registrasi2.php" method ="POST">
<div style ="width:30 cm;">
<label for ="nama">Nama</label>
<input type ="text" name ="nama" id="nama" value = ""/>
<label for = "nim">N I M</label>
<input type="text" name ="nim" id ="nim" value ="" />
<label for = "password1">Password</label>
<input type="password" name ="password1" id ="password1" value ="" />
<label for ="laki-laki">Apakah Anda Laki-Laki...</label>
<input type="radio" name="jk" id="Laki-Laki" value ="Laki-Laki"/>
<label for="perempuan">...atau perempuan?</label>
<input type="radio" name="jk" id="perempuan" value="perempuan"/>
<label for ="paket">paket yang anda pilih?</label>
<select name="paket" id="favoriteWidget" size="1">
<option value="platinum">Paket Platinum</option>
<option value="gold">Paket Gold</option>
<option value="silver">Paket Silver</option>
</select>
<input type="submit" name="daftar" id="daftar" value="Daftar"/>
</div>
</form>
</body>
</html>
Buat css untuk mengatur ukuran formnya dengan nama common.css:
/*Page Body */
body {font-family : Arial,helvetia,sans-serif;}
/*definition lists*/
dl {
width:100%;
margin:2em 0;
padding: 0;
clear: both;
overflow:auto;
}
dt {
width:30%;
float : left ;
margin:0;
padding: 5px 9.9% 5px 0; 0
order-top:1px solid #DDDDB7;
font-weight:bold;
overflow:auto;
clear:left;
}
dd {
width : 60%;
float :left;
margin:0;
padding:6px 0 5px 0;
border-top:1px solid #DDDDB7;
overflow:auto;
}
/*headings*/
h1{
font-weight:bold;
margin:35px 0 14px;
color:#666;
font-size:1.5em;
}
h2{
font-weight:bold;
margin:30px 0 12px;
color:#666;
font-size:1.3em;
}
h3{
font-weight:normal;
margin:30px 0 12px;
color:#666;
font-size:1.2em;
}
h4{
font-weight:bold;
margin:25px 0 12px;
color:#666;
font-size:1.0em;
}
h5{
font-weight:bold;
margin:25px 0 12px;
color:#666;
font-size:0.9em;
}
/*form*/
label { display:block;
float:left;
clear:both;
text-align:right;
margin:0.6em 5px 0 0;
width: 40%;
}
input,select,textarea {
float:right;
margin:1em 0 0 0;
width:57%;
}
input {
border:1px solid #666;
}
input[type=radio], iinput[type=checkbox],input[type=submit],input[type=reset],input[type=button],input[type=image]{
width:auto;
}
Buat file untuk menampilkan isi dari form-registrasi.html,degan nama registrasi.php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="on" lang="on">
<head>
<title>Membership Form</title>
<link rel="stylesheet" type="text/css" href="common.css" />
</head>
<body>
<h1>Anda Telah Terdaftar</h1>
<p>Berikut adalah data anda:</p>
<dl>
<dt>Nama Anda </dt><dd><?php echo $_POST["nama"]?></dd>
<dt>NIM</dt><dd><?php echo $_POST["nim"]?></dd>
<dt>Password</dt><dd><?php echo $_POST["password"]?></dd>
<dt>Jenis Kelamin</dt><dd><?php echo $_POST["jk"]?></dd>
<dt>Paket yang anda Pilih</dt><dd><?php echo $_POST["paket"]?></dd>
</dl>
</body>
</html>
Praktikum 6.2
Tambahkankan Password & Konfirmaasi password.jika password dan konfirmasi password tidak sama,maka muncul message box "Password tidak sama".code nya sebagai berikut :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="on" lang="on">
<head>
<tittle>Membership Form</tittle>
<link rel="stylesheet" type="text/css" href="common.css" />
<!--common.cs merupakan code dari buku Beginning PHP 5.3-->
</head>
<body>
<h1>Formulir Pendaftaran</h1>
<form action="registrasi2.php" method ="POST">
<div style ="width:30 cm;">
<label for ="nama">Nama</label>
<input type ="text" name ="nama" id="nama" value = ""/>
<label for = "nim">N I M</label>
<input type="text" name ="nim" id ="nim" value ="" />
<label for = "password1">Password</label>
<input type="password" name ="password1" id ="password1" value ="" />
<label for = "password2">Konfirmasi Password</label>
<input type="password" name ="password2" id ="password2" value ="" />
<label for ="laki-laki">Apakah Anda Laki-Laki...</label>
<input type="radio" name="jk" id="Laki-Laki" value ="Laki-Laki"/>
<label for="perempuan">...atau perempuan?</label>
<input type="radio" name="jk" id="perempuan" value="perempuan"/>
<label for ="paket">paket yang anda pilih?</label>
<select name="paket" id="favoriteWidget" size="1">
<option value="platinum">Paket Platinum</option>
<option value="gold">Paket Gold</option>
<option value="silver">Paket Silver</option>
</select>
<input type="submit" name="daftar" id="daftar" value="Daftar"/>
</div>
</form>
</body>
</html>
Jika tidak sama maka akan muncul sebagai berikut
Membuat code dengan form-registrasi html 5,jika ada field yang tidak di isi maka akan di beri tahu:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="on" lang="on">
<head>
<tittle>Membership Form</tittle>
<link rel="stylesheet" type="text/css" href="common.css" />
<!--common.cs merupakan code dari buku Beginning PHP 5.3-->
</head>
<body>
<h1>Formulir Pendaftaran</h1>
<form action="registrasi2.php" method ="POST">
<div style ="width:30 cm;">
<label for ="nama">Nama</label>
<input type ="text" name ="nama" id="nama" value = "" required = 'required'/>
<label for = "nim">N I M</label>
<input type="text" name ="nim" id ="nim" value ="" required = 'required' />
<label for = "password1">Password</label>
<input type="password" name ="password1" id ="password1" value ="" required = 'required'/>
<label for = "password2">Konfirmasi Password</label>
<input type="password" name ="password2" id ="password2" value ="" required = 'required' />
<label for ="laki-laki">Apakah Anda Laki-Laki...</label>
<input type="radio" name="jk" id="Laki-Laki" value ="Laki-Laki" required = 'required'/>
<label for="perempuan">...atau perempuan?</label>
<input type="radio" name="jk" id="perempuan" value="perempuan" required = 'required'/>
<label for ="paket">paket yang anda pilih?</label>
<select name="paket" id="favoriteWidget" size="1">
<option value="platinum">Paket Platinum</option>
<option value="gold">Paket Gold</option>
<option value="silver">Paket Silver</option>
</select>
<input type="submit" name="daftar" id="daftar" value="Daftar"/>
</div>
</form>
</body>
</html>
Menambahkan Field e-mail pada form-registrasi.html kemudian dimunculkan pada registrasi.php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="on" lang="on">
<head>
<tittle>Membership Form</tittle>
<link rel="stylesheet" type="text/css" href="common.css" />
<!--common.cs merupakan code dari buku Beginning PHP 5.3-->
</head>
<body>
<h1>Formulir Pendaftaran</h1>
<form action="registrasi3.php" method ="POST">
<div style ="width:30 cm;">
<label for ="nama">Nama</label>
<input type ="text" name ="nama" id="nama" value = "" required = 'required'/>
<label for = "nim">N I M</label>
<input type="text" name ="nim" id ="nim" value ="" required = 'required' />
<label for = "password1">Password</label>
<input type="password" name ="password1" id ="password1" value ="" required = 'required'/>
<label for = "password2">Konfirmasi Password</label>
<input type="password" name ="password2" id ="password2" value ="" required = 'required' />
<label for = "email">E-Mail</label>
<input type="text" name ="email" id ="email" value ="" required = 'required' />
<label for ="laki-laki">Apakah Anda Laki-Laki...</label>
<input type="radio" name="jk" id="Laki-Laki" value ="Laki-Laki" required = 'required'/>
<label for="perempuan">...atau perempuan?</label>
<input type="radio" name="jk" id="perempuan" value="perempuan" required = 'required'/>
<label for ="paket">paket yang anda pilih?</label>
<select name="paket" id="favoriteWidget" size="1">
<option value="platinum">Paket Platinum</option>
<option value="gold">Paket Gold</option>
<option value="silver">Paket Silver</option>
</select>
<input type="submit" name="daftar" id="daftar" value="Daftar"/>
</div>
</form>
</body>
</html>
code registrasi.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="on" lang="on">
<head>
<title>Membership Form</title>
<link rel="stylesheet" type="text/css" href="common.css" />
</head>
<body>
<?php
if ($_POST["password1"] != $_POST["password2"]){
echo "<script>alert ('password tidak sama ');</script>";
}
else
{?>
<h1>Anda Telah Terdaftar</h1>
<p>Berikut adalah data anda:</p>
<dl>
<dt>Nama Anda </dt><dd><?php echo $_POST["nama"]?></dd>
<dt>NIM</dt><dd><?php echo $_POST["nim"]?></dd>
<?php if (($_POST["password1"])== $_POST["password2"]){?>
<dt>Password</dt><dd><?php echo $_POST["password"]?></dd>
<?php } ?>
<dt>E-Mail</dt><dd><?php echo $_POST["email"] ?> </dd>
<dt>Jenis Kelamin</dt><dd><?php echo $_POST["jk"]?></dd>
<dt>Paket yang anda Pilih</dt><dd><?php echo $_POST["paket"]?></dd>
</dl>
<?php } ?>
</body>
</html>
Langganan:
Postingan (Atom)