PROGRAM INPUT DATA SISWA
pada kali ini saya akan memberikan/men-shering bagaimana program menginputkan data siswa sederhana.
pertama-tama kita harus buat file ny yang dimana nama file nya yaitu : InputData.php
codingannya :
<?php { ?> <html> <head> <title> Biodata siswa</title> <link href="style/style.css" rel="stylesheet" type="text/css" media="screen"/> </head> <body> <div id="wrapper"> <ul id="mainNav"> <li class="header"> Biodata siswa SMA/SMK</li> <li class="logout"><a href="#">Logout</a></li> </ul> <div id="containerHolder"> <div id="container"> <h2><a href="#">Masukan Data Lengkap Anda :</a> »</a></h2> <div id="main"> <?php if(isset($_GET['menu'])){ include $_GET['menu'].".php"; } ?> <form name="" method="POST" action="" ACTION="InputData.php"> <h2> <table> <tr> <td>NIS</td> <td><input type="text" name="nik" class="input"></td> </tr> <tr> <td>Nama siswa</td> <td><input type="text" name="nama" class="input"></td> </tr> <tr> <td>jenis kelamin</td> <td><input type="radio" name="jk" class="input"value="laki-laki">laki-laki <input type="radio" name="jk" class="input" value="perempuan">perempuan </tr> <tr> <td>NO.HP Orang Tua</td> <td><input type="text" name="HP" class="input"></td> </tr> <tr> <td>Hoby</td> <td><input type="text" name="Hoby" class="input"></td> </tr> <tr> <td>Tempat / Tanggal Lahir</td> <td><input type="text" name="tempat" class="input"> / <input type="text" name="tgllahir" class="input"></td> </tr> <tr> <td>Pendidikan</td> <td><select name="pendidikan" class="input"> <option> </option> <option> SMK</option> <option>SMA</option> <option>SMP</option> <option>SD</option> <option>TK</option> </select></td> </tr> <tr> <td>Alamat</td> <td><textarea name="alamat" rows="5" cols="50" class="input"></textarea></td> </tr> <tr> <td> </td> <td><input type="submit" name="simpan" value="Simpan" class="submit"> <input type="reset" name="batal" value="Batal" class="submit"></td> </tr> </h2> </table> </FORM> <div id="hasil"> <?php if (isset($_POST['simpan'])){ echo "Hasil data lengkap Anda :<br><br>"; if (isset($_POST['nik'])){ echo "NIK : " . $_POST['nik']. "<br>"; } if (isset($_POST['nama'])){ echo "Nama : " . $_POST['nama']. "<br>"; } if (isset($_POST['jk'])) { echo "JENIS KELAMIN :".$_POST['jk']."<br>"; } if (isset($_POST['HP'])){ echo "NO.HP orang tua : " . $_POST['HP']. "<br>"; } if (isset($_POST['Hoby'])){ echo "hoby saya : " . $_POST['Hoby']. "<br>"; } if (isset($_POST['tempat'])){ echo "Tempat : " . $_POST['tempat']. ""; } if (isset($_POST['tgllahir'])){ echo "/ " . $_POST['tgllahir']. "<br>"; } if (isset($_POST['pendidikan'])){ echo "Pendidikan : " . $_POST['pendidikan']. "<br>"; } if (isset($_POST['alamat'])){ echo "Alamat : " . $_POST['alamat']. "<br>"; } } ?> </div> </div> <div class="clear"></div> </div> </div> <p id="footer"> </p> </div> </body> </html> <?php }
cssnya :
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
/* remember to define focus styles! */
:focus {
outline: 0;
}
/* remove textarea resize at Safari */
textarea {
resize: none;
}
/* remember to highlight inserts somehow! */
ins {
text-decoration: none;
}
del {
text-decoration: line-through;
}
/* tables still need 'cellspacing="0"' in the markup */
table {
border-collapse: collapse;
border-spacing: 0;
}
/* Basic ---------------------------------------- */
.clear { clear: both; }
body {
background:url(../images/satu.jpg);
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
#wrapper {
text-align: left;
width: 930px;
margin: 20px auto;
}
/* Logo ---------------------------------------- */
h1 {
margin: 15px 0 10px 5px;
width: 225px;
height: 28px;
font-size: 30;
}
h1 a {
display: block;
width: 225px;
height: 28px;
}
h1 span { display: none; }
/* Main Navigation ---------------------------------------- */
#mainNav {
width: 918px;
height: 37px;
padding: 6px;
margin: 0 0 10px 0;
background: url(../images/top-menu-bg.gif) no-repeat left top;
/* We used a background image making the thick border and the thin one to keep the html structure simple */
}
#mainNav li a {
display: block;
float: left;
height: 37px;
font-weight: bold;
line-height: 37px;
text-decoration: none;
color: #646464;
padding: 0 20px;
}
#mainNav li.logout {
float: right;
border-left: 1px solid #ddd;
border-right: none;
}
#mainNav li.header {
float: left;
padding: 10px;
border-right: none;
text-align: center;
font-weight: bold;
font-size: 20px;
color: #C87C5B;
}
#mainNav li a:hover { background: #fdfcf6; }
#mainNav li a.active, #mainNav li a.active {
color: #454545;
}
/* Container ---------------------------------------- */
#containerHolder {
background: #eee;
padding: 5px;
}
#container {
background: #fff url(../images/content.gif) repeat-y left top;
border: 1px solid #ddd;
width: 918px;
}
/* Breadcrumb ---------------------------------------- */
h2 {
width: 718px;
float: right;
color: #646464;
font-size: 16px;
line-height: 16px;
font-weight: bold;
margin: 20px 0 0 0;
padding: 0 0 10px 0;
border-bottom: 1px solid #ddd;
}
h2 a {
color: #646464;
text-decoration: none;
}
h2 a.active { color: #c66653; }
h2 a:hover { text-decoration: underline; }
/* Content ---------------------------------------- */
#main {
width: 700px;
float: right;
padding: 0 20px 0 0;
}
h3 {
font-size: 14px;
line-height: 14px;
font-weight: bold;
color: #5494af;
padding: 0 0 0 10px;
margin: 20px 0 10px;
}
#main table {
border-top: 1px solid #ddd;
width: 738px;;
}
#main table tr td {
background: #f6f6f6;
padding: 0px 20px;
height: 29px;
line-height: 29px;
border-bottom: 1px solid #ddd;
}
#main table tr.odd td {
background: #fbfbfb;
}
#main table tr:hover td { background: #fdfcf6; }
#main table .action {
text-align: right;
padding: 0 20px 0 10px;
}
#main table tr .action a { margin: 0 0 0 10px; text-decoration: none; color: #9b9b9b; }
#main table tr:hover .action .edit { color: #c5a059; }
#main table tr:hover .action .delete { color: #a02b2b; }
#main table tr:hover .action .view { color: #55a34a; }
#main table tr:hover .action a:hover { text-decoration: underline; }
.submit {
font: 11px Arial, Helvetica, sans-serif;
color: #646464;
width: 94px;
height: 29px;
cursor: pointer;
border: none;
font-size: 15px;
font-weight: bold;
background: url(../images/button-submit.gif) no-repeat left top;
}
#hasil {
margin: 5px;
font-size: 15px;
font-weight: bold;
line-height: 20px;
color: #3E3E3E;
padding: 5px;
}
/* Footer ---------------------------------------- */
#footer {
margin: 10px 0 30px 0;
font-size: 11px;
line-height: 11px;
color: #9B9B9B;
padding: 0 0 0 5px;
}
#footer a { color: #9B9B9B; }
#footer a:hover { text-decoration: none; }
.x{
vertical-align: top;
}
Kalian bisa mendownload source code nya di bawah ini
KLIK download :
nah temen-temen sampai di sini dulu tentang program input data siswa . apa bila ada kebinggungan comentar aja dikolom komentar,may be useful for you :)
EmoticonEmoticon