Membuat BIODATA sederhana dengan php
dan tentu saja biodata ini ebrjalan di localhost aliast "xamp"
ini dia source codenya :
Terdiri dari :
hapus.php
<?
session_start();
session_destroy();
echo "<p>Data Buku tamu sudah dihapus semua</p>";
echo "<a href=index.php> Klik Disini </a> Untuk Mengisi Form Buku Tamu";
?>
biodata_submit.php
<html>
<head>
<title>Penggunaan Form 2</title>
</head>
<body>
<?php
$nim=$_POST["nim"];
$nama=$_POST["nama"];
$jur=$_POST['jur'];
$alamat=$_POST['alamat'];
$telepon=$_POST['telepon'];
echo "<h1 align='center'>Data Mahasiswa</blink></h1><br>";
echo "<b>Nim anda :</b> $nim<br>";
echo "<b>Nama Anda :</b> $nama<br>";
echo "<b>Jurusan :</b> $jur<br>";
echo "<b>Alamat :</b> $alamat<br>";
echo "<b>Telepon :</b> $telepon";
?>
</body>
</html>
isi.php
<?php
session_start();
echo "<table border=0>";
echo "<p><u><strong>BIODATA</strong></u><p>";
for ($i=0;$i<count($_SESSION['a']);$i++)
{
echo "<tr><td>Nama </td><td>: " .$_SESSION['a'][$i][0]."</td></tr>";
echo "<tr><td>Email </td><td>: " .$_SESSION['a'][$i][1]."</td></tr>";
echo "<tr><td>Komentar </td><td>: " .$_SESSION['a'][$i][2]."</td></tr>
<tr><td> <hr></td><td> <hr></td></tr>";
}
echo "</table>";
echo "<a href=index.php> Klik Disini </a> Untuk Mengisi Form Buku Tamu"."<br/>";
echo "<a href=hapus.php> Klik Disini </a> Untuk Menghapus Semua Data Buku Tamu";
?>
<html>
<head>
<title>BIODATA</title>
</head>
<body>
</body>
</html>
biodata.php
<html>
<head>
<title>Penggunaan Form 2</title>
</head>
<body>
<h1 align="center">FORM BIODATA MAHASISWA</h1>
<hr>
<form action="../biodata_submit.php" method="post"><pre>
NIM : <input type ="text" name="nim" /><br />
Nama Lengkap : <input type="text" name="nama" /><br />
Jurusan : <select name="jur">
<option value="Komputer Akuntansi">KA</option>
<option value="Manajemen Informatika">MI </option>
<option value="Teknik Komputer">TK</option></select><br />
Alamat : <textarea name="alamat" rows="5" cols="30"></textarea><br>
Telepon : <input type="text" name="telepon"><br>
<input type="submit" value="SUBMIT" />
</form>
</body>
</html>
index.php
<?php
session_start();
for ($data=0;$data<10;$data++) {
if ($_SESSION ['a'][$data][0]=="") {
$_SESSION['a'] [$data][0]= $_POST['nama'];
$_SESSION['a'] [$data][1]= $_POST['email'];
$_SESSION['a'] [$data][2]= $_POST['komentar'];
break; }}
?>
<html>
<head>
<tittle></title>
<STYLE TYPE="text/css">
fieldset {
-moz-border-radius: 7px; border: 1px #dddddd solid; padding: 10px; width: 400px; margin-top: 10px;
}
fieldset legend {
border: 1px #1a6f93 solid; color: black; font: 13px Verdana; -moz-border-radius: 3px;
}
</STYLE>
</head>
<body>
<fieldset>
<legend><strong><font size="4" face="Courier New, Courier, mono">BIODATA</font></strong></legend>
<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<table width="79%" border="0" align="left">
<tr>
<td>Nama </td>
<td> <input type="text" name="nama" id="nama"> </td>
</tr>
<tr>
<td>E-Mail </td>
<td> <input type="text" name="email" id="email"> </td>
</tr>
<tr>
<td>Komentar </td>
<td> <textarea name="komentar" id="komentar" rows="10" cols="30"></textarea> </td>
</tr>
<tr>
<td> </td>
<td> <input type="submit" name="Submit" value="Kirim">
<input type="reset" name="Submit2" value="Batal">
<p><a href='isi.php'>::Lihat BIODATA::</a></p>
</td>
</tr>
</table>
</form>
</fieldset>
</body>
</html>
bila kalian kesal karena harus mengkopi dan menaruh2 satu demi satu. kalian bisa download source codenya di SINI.
No comments:
Post a Comment