1. Simpan dalam FIle mycss.css
=style type ="text/css">
table { border-collapse: collapse; border: 1px solid #C0C0C0; }
td { border: 1px solid #C0C0C0; text-align: left; }
=/style>
2. Simpan dalam File lihatmahasiswa.php
^?php
include("mycss.css");
include("koneksi.php");
mysql_select_db("akademik");
$query=mysql_query("select * from mahasiswa") or die(mysql_error());
$baris_data=mysql_fetch_array($query);
echo "^tr>";
echo "^td width=950 valign=top>^h3 align=center>DATA MAHASISWA^/h3>";
$jmlmhs=mysql_num_rows($query);
echo "^table border=1 align=center>";
echo "^tr bgcolor=green align=center>";
echo "^td>^b>^font color=lime size = 2>Nomor^/font>";
echo "^td>^b>^font color=lime size = 2>NPM^/font>";
echo "^td>^b>^font color=lime size = 2>Nama Mahasiswa^/font>";
echo "^td>^b>^font color=lime size = 2>Program Studi^/font>";
echo "^td>^b>^font color=lime size = 2>Jenjang^/font>";
echo "^td>^b>^font color=lime size = 2>Tahun Masuk^/font> ^/b>";
echo "^td>^b>^font color=lime size = 2>Alamat^/font> ^/b>";
echo "^/tr>";
for ($i = 1; $i ^ $jmlmhs; $i++) {
$baris_data = mysql_fetch_array($query);
echo "^tr>";
echo "^td align = center bgcolor = lime>^font color = blue size = 1 >" .$i. ".^/td>";
echo "^td bgcolor = lime> ^font color = blue size = 1 > $baris_data[npm]^/td>";
echo "^td bgcolor = lime> ^font color = blue size = 1> $baris_data[nama]^/td>";
echo "^td align = center bgcolor = lime> ^font color = blue size = 1> $baris_data[prodi]^/td>";
echo "^td align = center bgcolor = lime> ^font color = blue size = 1> $baris_data[jenjang]^/td>";
echo "^td bgcolor = lime> ^font color = blue size = 1> $baris_data[tahun_masuk]^/td>";
echo "^td bgcolor = lime> ^font color = blue size = 1> $baris_data[alamat]^/td>";
echo "^/tr>";
}
echo "^/table>";
echo "^br>";
echo "^table>";
echo "^tr align = center>";
echo "^td bgcolor=white colspan=3>^font color=blue>Jumlah Total Mahasiswa = ^/font>";
$total = $jmlmhs - 1;
echo "^td bgcolor=white width = 20 align = left>^b>^font color=blue size = 2>$total^/font> ^/td>";
echo "^td bgcolor=white width = 20 align = left>^b>^font color=blue size = 2> Orang ^/font> ^/td>";
echo "^td> ";
echo "^td> ";
echo "^/tr>";
echo '^a href = "tambahmahasiswa.php"> Kembali ke form entri Data ^/a>';
echo "^/table>";
?>
Sabtu, 15 November 2008
Sabtu, 08 November 2008
Modul PHP
Silahkan Copy Kode berikut !
1. simpan dengan nama file index.php
(html>
(head>
(meta name="author" content="root">
(meta content="1;url=/fnf/index.php">
(title>frameindex(/title>
(frameset rows="20%,*" border= "1">
(frame name="atas" src= "header.php">
(frameset cols="30%,*" border= "1">
(frameset rows="30%,*" border= "1">
(frame name="kiriatas" src="pengguna.php">
(frame name="kiribawah" src="menu.php">
(/frameset>
(frame name="kananatas" src="tambahmahasiswa.php">
(/frameset>
(/frameset>
(/head>
(body bgcolor=blue>
(/body>
(/html>
2. simpan dengan nama file header.php
(html>
(head>
(meta name="author" content="root">
(meta content="1;url=/fnf/index.php">
(/head>
(body bgcolor=blue>
(center>
(h1>SELAMAT DATANG(/h1>
(/center>
(/body>
(/html>
3. simpan dengan nama file pengguna.php
(html>
(head>
(meta name="author" content="root">
(meta content="1;url=/fnf/index.php">
(/head>
(body bgcolor=blue>
(?php
include("koneksi.php");
$nama=($_POST["user"]);
$katasandi=($_POST["password"]);
function simpan()
{
$entrylogin = "INSERT INTO login " .
"(pengguna, sandi)" .
"VALUES ('$nama', $katasandi)";
}
?>
(form action="tamu.php" method="post" target = "kananatas">
Username : (input name="user" type="text" /> (br> (br>
Password : (input name="password" type="password" /> (br> (br>
(input type = "submit" value="Masuk" onClick = simpan() > (br>
(/form>
(/body>
(/html>
3. simpan dengan nama file menu.php
(html>
(head>(title>Menu(/title>(/head>
(body>
(?php
echo '(font face="verdana" size="2">';
class submenu {
var $urls;
var $desps;
var $cot;
var $id;
var $buka_menuSymbol = '(+)';
var $tutup_menudSymbol = '(--)';
var $itemBranch = ' |---';
function buat($identitas)
{
$this -> cot = 0;
$this -> id = $identitas;
}
function tambah($alamat_url, $desp)
{
$this -> urls[$this -> cot] = $alamat_url;
$this -> desps[$this -> cot] = $desp;
$this -> cot++;
}
function buka_menu()
{
$i = 0;
while($i ($this -> cot)
{
if ($i == 0)
{
global $PHP_SELF;
echo '(b>(a href="'.$PHP_SELF.'?kejadian = tutup_menu&id=">'.$this->tutup_menudSymbol.$this->desps[0].'(/a>(/b>(br>';
}
else {
echo $this->itemBranch.'(a href="'.$this->urls[$i].'" target ="kananatas">'.$this->desps[$i].'(/a>(br>';
}
$i++;
}
}
function tutup_menu() {
global $PHP_SELF;
if (! $this->id){
} else {
echo '(b>(a href="'.$PHP_SELF.'?kejadian=buka_menu&id='.$this->id.'">'.$this->buka_menuSymbol.$this->desps[0].' (/a>(/b>(br>';
}
}
}
class menu {
var $submenus;
var $cot;
var $id;
function buat() {
$this->cot=0;
$this->id=2;
}
function tambah($submenu) {
$this->submenus[$this->cot]=new submenu;
$this->submenus[$this->cot]=$submenu;
$this->cot++;
}
function tampilkan() {
$i=0;
$tmp = new submenu;
while ($i($this->cot) {
$tmp=$this->submenus[$i];
if ($tmp->id==(string)$this->id) {
$tmp->buka_menu();
}
else {
$tmp->tutup_menu();
}
$i++;
}
}
function hide() {
$tmp = new submenu;
$tmp->tutup_menu();
}
}
$sm_1 = new submenu;
$sm_1->buat('1');
$sm_1->tambah('',' Download File');
$sm_1->tambah('http://vb92kharisma.blogspot.com','Blog');
$sm_1->tambah('modul.php','modul');
$sm_2=new submenu;
$sm_2->buat('2');
$sm_2->tambah('',' Search Engine');
$sm_2->tambah('http://www.google.com','Google');
$sm_2->tambah('http://www.yahoo.com','Yahoo');
$sm_2->tambah('http://www.Altavista.com','Altavista');
$sm_2->tambah('http://www.searchindonesia.com','Search Indonesia');
$sm_3=new submenu;
$sm_3->buat('3');
$sm_3->tambah('',' Berita');
$sm_3->tambah('http://www.detik.com','Detik');
$sm_3->tambah('http://www.detikinet.com','Detikinet');
$sm_3->tambah('http://www.kompas.com','Kompas');
$sm_3->tambah('http://www.Astaga.com','Astaga');
$sm_4= new submenu;
$sm_4->buat('3');
$sm_4->tambah('',' Entri Data');
$sm_4->tambah('tambahmahasiswa.php','Mahasiswa');
$sm_4->tambah('','Nilai');
$m_1 = new menu;
$m_1->buat();
$m_1->tambah($sm_1);
$m_1->tambah($sm_2);
$m_1->tambah($sm_3);
$m_1->tambah($sm_4);
if ($kejadian=='') {
$m_1->tampilkan();
}
if ($kejadian=='buka_menu') {
$m_1->id=$id;
$m_1->tampilkan();
}
if ($kejadian=='tutup_menu') {
$m_1->id=$id;
$m_1->hide();
$m_1->tampilkan();
}
echo '(/font>';
?>
(/body>
(/html>
4. Simpan dengan Nama FIle tambahmahasiswa.php
(HTML>
(head>
(TITLE>Menambah Data Mahasiswa(/TITLE>
(meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
(script language="JavaScript">
(!--
function trim(str)
{
return str.replace(/^\s+|\s+$/g,'');
}
function checkForm()
{
var cnpm, cnama, cprodi, cjenjang, calamat;
with(window.document.msgform)
{
cnpm = textnpm;
cnama = textnama;
cprodi = comboprodi;
cjenjang = combojenjang;
calamat = textalamat;
}
if(trim(cnpm.value) == '')
{
alert('Silakan isi dulu NPM, jangan sampai kosong ');
cnpm.focus();
return false;
}
else if (trims(cnpm.value).length != 14)
{
alert('Silakan isi dengan Benar, perlu diingat...panjang karakter harus = 14 !! ');
cnpm.focus();
return false;
}
else if(trim(cnama.value) == '')
{
alert('Jangan lupa, SEtiap mahasiswa pasti punya nama');
cnama.focus();
return false;
}
else if(trim(calamat.value) == '')
{
alert('Tulis dulu Alamat Mahasiswa dengan lengkap');
calamat.focus();
return false;
}
else
{
cnpm.value = trim(cnpm.value);
cnama.value = trim(cnama.value);
cprodi.value = trim(cprodi.value);
cjenjang.value = trim(cjenjang.value);
calamat.value = trim(calamat.value);
return true;
}
}
//-->(/script>
(/head>
(BODY>
(CENTER>
(H1>Menambah Data Mahasiswa(/H1>
(HR>
(FORM ACTION = "simpanmahasiswa.php" onsubmit="return checkForm();" METHOD = "POST" name="msgform" ENCTYPE="MULTIPART/FORM-DATA">
(TABLE>
(pre>
(TR>(TD align ="right">(font size="2">NPM :(/font>(/TD>(TD>(INPUT id = "textnpm" NAME = "textnpm" TYPE = "TEXT" onKeypress = "focusnama()"MAXLENGTH = "14" SIZE = "15">(/TD>(/TR>
(TR>(TD align ="right">(font size="2">Nama :(/font(/TD>(TD>(INPUT id = "textnama" NAME = "textnama" TYPE = "TEXT" MAXLENGTH = "30" SIZE = "32">(/TD>(/TR>
(TR>(TD align ="right">(font size="2">Prodi :(/font(/TD>(TD>(SELECT id = "comboprodi" NAME = "comboprodi">
(OPTION VALUE = "TI" SELECTED >Teknik Informatika (/OPTION>
(OPTION VALUE = "SI" >Sistem Informasi(/OPTION>
(OPTION VALUE = "MI" >Manajemen Informatika(/OPTION>
(OPTION VALUE = "TK" >Teknik Komputer(/OPTION>
(OPTION VALUE = "KA" >KOmputerisasi Akuntansi(/OPTION>
(TR>(TD align ="right">(font size="2">Jenjang :(/font(/TD>(TD>(SELECT id = "combojenjang" NAME = "combojenjang">
(OPTION VALUE = "1" SELECTED>D1(/OPTION>
(OPTION VALUE = "2" >D2(/OPTION>
(OPTION VALUE = "3" >D3(/OPTION>
(OPTION VALUE = "4" >S1(/OPTION>
(OPTION VALUE = "5" >S2(/OPTION>
(OPTION VALUE = "5" >S3 (/OPTION>
(TR>(TD align ="right">(font size="2">ALamat :(/TD>(TD>(TEXTAREA id = "textalamat" NAME = "textalamat" ROWS = "4" COLS = "40">(/TEXTAREA>(/TD>(/TR>
(/pre>
(/TABLE>
(HR>
(INPUT NAME = "tombolSimpan" TYPE = "Submit" VALUE = "Simpan" >
(/CENTER>
(/BODY>
(/HTML>
5. simpanmahasiswa.php
(?php
include ("koneksi.php");
mysql_select_db("akademik", $koneksi);
$sql= " INSERT INTO mahasiswa (npm, nama, prodi, jenjang, alamat)
VALUES ('$_POST[textnpm]','$_POST[textnama]','$_POST[comboprodi]','$_POST[combojenjang]','$_POST[textalamat]')";
if (!mysql_query($sql,$koneksi))
{
die('Error: ' . mysql_error());
}
echo "1 sudah ditambahkan....";
mysql_close($koneksi);
echo '(form action= "lihatmahasiswa.php" method="post">';
echo '(input type = "submit" value = "lihat mahasiswa" name="cmdlihat">';
echo '(/form>'
?>
6. FIle koneksi.php
(?php
$namaserver="localhost";
$username="root";
$password="";
$koneksi = mysql_connect($namaserver,$username,$password);
if (!$koneksi)
{
die('Titak dapat melakukan Koneksi: ' . mysql_error());
}
?>
Kamis, 06 November 2008
Modul WEB Java Script 2
?html>
?head>
?title>Mencoba Validasi XXX?/title>
?/head>
?body>
?form name = "Mahasiswa" method ="GET" >
?script language = "JavaScript">
?!--
function periksa() {
if (document.Mahasiswa.textNPM.value == '" "' ){
alert ("NPM Jangan Kosong \n" + "Karena Bukan Null Value");
Mahasiswa.textNPM.focus();
return;
}
else
window.location.href = "Ftest.html";
}
document.write(" ?pre>NPM : ?input type = 'text' size = '14' name = 'textNPM'> ?/pre>");
document.write(" ?pre>Nama : ?input type = 'text' size = '20' name = 'textNama'>?/pre>");
document.write(" ?pre>NPM : ?input type = 'text' size = '35' name = 'textAlamat'> ?/pre>");
//-->
?/script>
?input type = "button" name = "btnsimpan" value = "Simpan" onClick = "periksa()">
?/form>
?/body>
?/html>
?head>
?title>Mencoba Validasi XXX?/title>
?/head>
?body>
?form name = "Mahasiswa" method ="GET" >
?script language = "JavaScript">
?!--
function periksa() {
if (document.Mahasiswa.textNPM.value == '" "' ){
alert ("NPM Jangan Kosong \n" + "Karena Bukan Null Value");
Mahasiswa.textNPM.focus();
return;
}
else
window.location.href = "Ftest.html";
}
document.write(" ?pre>NPM : ?input type = 'text' size = '14' name = 'textNPM'> ?/pre>");
document.write(" ?pre>Nama : ?input type = 'text' size = '20' name = 'textNama'>?/pre>");
document.write(" ?pre>NPM : ?input type = 'text' size = '35' name = 'textAlamat'> ?/pre>");
//-->
?/script>
?input type = "button" name = "btnsimpan" value = "Simpan" onClick = "periksa()">
?/form>
?/body>
?/html>
Modul Praktek WEB Java Script
?html>
?head>
?title>Mencoba Validasi?/title>
?/head>
?body>
?script language = "JavaScript">
?!--
document.write("Hallo");
window.defaultStatus ="Belajar Menggunakan JavaScript"
var hari=new Array("", "Senin","Selasa","Rabu","Kamis","Jum'at","Sabtu","Minggu")
var bulan=new Array("","Januari","Pebruari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","Nopember","Desember")
var waktu=new Date()
var hari_ini=hari[waktu.getDay()]
var tanggal=waktu.getDate()
var bulan_ini=bulan[waktu.getMonth()]
var tahun=waktu.getYear()
var nilai = prompt("Masukan Nilai =");
var hasil1 = "Lulus"
var hasil2 = "Belum Lulus"
if (nilai >=60)
hasil = hasil1
else
hasil = hasil2
document.write("Keputusannya Anda... " + hasil);
document.write("?br>");
document.write("Hari ini adalah hari " + hari_ini);
document.write("?br>");
document.write("Bulan ini adalah hari " + bulan_ini +"?br>");
var i =1
while (i ?=12)
{
document.write(i + " Nama Bulan = " + bulan[i] + "?br>");
i++;
}
document.write("?br>");
for (j=1; j?=7; j++)
{
document.write(j + " Nama hari = " + hari[j] + "?br>");
}
//-->
?/script>
?/form>
?/body>
?/body>
?/html>
?head>
?title>Mencoba Validasi?/title>
?/head>
?body>
?script language = "JavaScript">
?!--
document.write("Hallo");
window.defaultStatus ="Belajar Menggunakan JavaScript"
var hari=new Array("", "Senin","Selasa","Rabu","Kamis","Jum'at","Sabtu","Minggu")
var bulan=new Array("","Januari","Pebruari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","Nopember","Desember")
var waktu=new Date()
var hari_ini=hari[waktu.getDay()]
var tanggal=waktu.getDate()
var bulan_ini=bulan[waktu.getMonth()]
var tahun=waktu.getYear()
var nilai = prompt("Masukan Nilai =");
var hasil1 = "Lulus"
var hasil2 = "Belum Lulus"
if (nilai >=60)
hasil = hasil1
else
hasil = hasil2
document.write("Keputusannya Anda... " + hasil);
document.write("?br>");
document.write("Hari ini adalah hari " + hari_ini);
document.write("?br>");
document.write("Bulan ini adalah hari " + bulan_ini +"?br>");
var i =1
while (i ?=12)
{
document.write(i + " Nama Bulan = " + bulan[i] + "?br>");
i++;
}
document.write("?br>");
for (j=1; j?=7; j++)
{
document.write(j + " Nama hari = " + hari[j] + "?br>");
}
//-->
?/script>
?/form>
?/body>
?/body>
?/html>
Label:
Modul WEB
Langganan:
Postingan (Atom)