Jumat, 11 Februari 2011
Tugas PHP
Kurs.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=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
 $nilai=$_POST['nilai'];
 switch ($nilai)
 {
  case"dolar_us":
  $kurs='9020';
  break;
  case"dolar_singapura":
  $kurs='6320';
  break;
  case"euro":
  $kurs='12600';
  break;
  default;
 }
 $total=$kurs*$_POST['uang'];
 echo"Nilainya adalah $total rupiah";
?>
</body>
</html>
form2.html
<!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=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
 font-family: "Courier New", Courier, monospace;
 font-size: 36px;
 color: #3300FF;
}
.style2 {font-family: Georgia, "Times New Roman", Times, serif}
-->
</style>
</head>
<body>
<form name="form2" method="post" action="kurs.php">
<h2 align="center" class="style1">KURS MATA UANG</h2>
<div align="center" class="style2"><br />
  Nilai :
  <input type="text" name="uang" size="10" />
  <br />
  <br />
  Mata Uang :
  <select name="nilai">
    <option value="dolar_us">Dolar US</option>
    <option value="dolar_singapura">Dolar Singapura</option>
    <option value="euro">Euro</option>
  </select>
  <br />
  <br />
  <input type="submit" name="submit" value="submit" />
</div>
</form>
</body>
</html>
Form1.html
<!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=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
 font-family: "Courier New", Courier, monospace;
 font-size: 36px;
 color: #3333CC;
}
.style2 {font-family: Georgia, "Times New Roman", Times, serif}
-->
</style>
</head>
<body>
<form name="form1" method="post" action="login.php">
<h2 align="center" class="style1">PRAKTIKUM PERCABANGAN</h2>
<div align="center" class="style2"><br />
  Username :
  <input type="text" name="username" size="10" />
  <br />
  <br />
  Password :
  <input type="password" name="pass" size="10" />
  <br />
  <br />
  <input type="submit" name="submit" value="submit" />
</div>
</form>
</body>
</html>
Login.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=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
$username=$_POST['username'];
$password=$_POST['pass'];
 if($username=="admin" && $password=="123456"){
  echo"SELAMAT DATANG";}
 else{
  echo"COBA LAGI";}
 ?>
</body>
</html>
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar