Kamis, 10 Juni 2010

Entri Buku dan Validasinya

@html>
@head>
@title>Entri Data Buku@/title>
@meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
@Script type="text/JavaScript" src=ajax1mhs.js>@/script>

(di bawah ini script validasi!!!!)

@script language="javascript">
@!--
function trim(str)
{
return str.replace(/^\s+|\s+$/g,'');
}
function validasi()
{
var ckode_buku, cjudul;
with(window.document.fbuku)
{
ckode_buku = textkode_buku;
cjudul = textjudul;
}
if(trim(ckode_buku.value)=='')
{
alert('Silakan isi dulu kode buku');
ckode_buku.focus();
return false;
}
else
if(trim(cjudul.value)=='')
{
alert('Silakan isi terlebih dahulu judul buku');
cjudul.focus();
return false;
}
else
{
ckode_buku.value = trim(ckode_buku.value);
cjudul.value = trim(cjudul.value);
}
}
//-->

@/script>
@/head>
@/head>


@body>
@form name=fbuku onsubmit="validasi();" action= "simpan_buku.php" method= "POST">
@center>
@h3>ENTRI BUKU@/h3>
@table>
@tr>@td>Kode Buku@/td>@td>:@/td>
@td>@input type=text name="kode_buku" size=6 maxlength=6>@input type=button value=? OnClick='lihat_mahasiswa(kode_buku.value);'>@/td>
@/tr>

@tr>@td colspan=3> @div id=TEMPAT>@/div>@/td>@/tr>

@tr>@td>judul@/td>@td>:@/td>
@td>@input type=text name="judul" size=20 maxlength=20>@/td>
@/tr>
@tr>@td>@input type=submit value=simpan>@/td>@/tr>

@/table>
@/center>
@/form>
@/body>
@/html>

Koneksi

@?php
$namaserver="localhost";
$username="root";
$password="stmik09";
$koneksi = mysql_connect($namaserver,$username,$password);
if (!$koneksi)
{
die ('koneksi gagal !!: ' .mysql_error());
}
?>

Form Simpan Buku

@?Php
include ("koneksi.php");
$kode_buku = $_POST[kode_buku];
$judul = $_POST[judul];

echo $kode_buku;
echo "@BR>".$judul;
mysql_select_db('perpustakaan');
$query_buku=mysql_query("INSERT INTO buku1(kode_buku,judul) VALUES ('".$kode_buku."','".$judul."')");
echo "Data Berhasil Disimpan";
?>

Form Lihat Buku

@?php
include ('koneksi.php');
mysql_select_db("perpustakaan");
$periksa= mysql_query('SELECT * FROM buku1 where kode_buku=$kode');
if($periksa !=0);
{
echo 'Data sudah ada, silakan entri baru';
}
$querybuku01= mysql_query('SELECT * FROM buku1');
$jumlah = mysql_num_rows($querybuku1);
echo '@table>';
echo '@tr>@th>kode buku@/th>@th>judul buku@/th>@/tr>';
for ($i = 0; $i @= $jumlah; $i++);
{
$buku = mysql_fetch_array($querybuku1);
echo '@tr>@td> '.$buku[kode_buku].' @/td>';
echo ' @td> '.$buku[judul].'@/td> @/tr>';
}
echo '@/table>';
?>

Form Entri Buku

@html>
@head>
@title>Form Entri Buku@/title>
@/head>
@body>
@h4>FORM ENTRI DATA BUKU@/h4>
@form name="fbuku" action="simpan_buku.php" method=POST>

@table>
@tr>
@td>Kode Buku@/td>@td>:@/td>
@td>@input type = text name=textbuku size=7 maxlength=6>@/td>
@/tr>

@tr>
@td>Judul@/td>@td>:@/td>
@td>@input type = text name= judul size=15 maxlength=30>@/td>
@/tr>

@tr>
@td colspan=3>
@input type = submit name=btnsimpan value=simpan>
@/td>
@/tr>
@/table>
@form>
@/body>
@/html>

Sabtu, 06 Maret 2010

LIHAT BUKU

@?php
include('koneksi.php');
mysql_select_db('DBPerpustakaan');

$query_buku = mysql_query("SELECT * FROM buku01");
$jm_baris = mysql_num_rows($query_buku);

echo "@table>";
echo "@tr>@th>Nomor@/th> @th>Kode Buku@/th> @th>Judul Buku@/th>@/tr>";

for ($i=1; $i@= $jm_baris; $i++)
{
$buku = mysql_fetch_array($query_buku);
echo "@tr>@td>".$i."@/td> @td>".$buku[kode]."@/td> @td>".$buku[judul]."@/td>@/tr>";
}
echo "@/table>";
?>

MENU

@html>
@head>
@title>Menu Utama@/title>
@/head>
@body>
@h1>MENU@/h1>
@br>@a href='form_buku.php' target='isi'>Master Buku@/a>
@br>@a href='lihat_buku.php' target='isi'>Lihat Data@/a>
@br>@a href='cetak_buku.php' target='isi'>Cetak@/a>
@h5>copyright@2010@/h5>
@p>be a creative@/p>
@/body>
@/html>

FORM BUKU

@html>
@head>
@title>Form Entri Buku@/title>
@/head>
@body>
@h4>FORM ENTRI DATA BUKU@/h4>
@form name="fbuku" action="simpan_buku.php" method=POST>

@table>
@tr>
@td>Kode Buku@/td>@td>:@/td>
@td>@input type = text name=textbuku size=7 maxlength=6>@/td>
@/tr>

@tr>
@td>Judul@/td>@td>:@/td>
@td>@input type = text name= judul size=15 maxlength=30>@/td>
@/tr>

@tr>
@td colspan=3>
@input type = submit name=btnsimpan value=simpan>
@/td>
@/tr>
@/table>
@form>
@/body>
@/html>

SIMPAN BUKU

@?php>
include('koneksi.php');
mysql_select_db('DBPerpustakaan');
$kode = $_POST[textbuku];
$judul = $_POST[judul];

$query_buku = mysql_query("SELECT * FROM buku01 WHERE kode='".$kode."'");
$jm_baris = mysql_num_rows($query_buku);

if($jm_baris==1)
{
echo "@h3>Maaf Data Sudah Ada, silakan entri data baru..@/h3>";
echo "@br>@a href = form_buku.php> Kembali Ke Form Buku@/a>";
return;
}
$tambah_buku = mysql_query("INSERT INTO buku01(kode,judul) VALUES ('$kode','$judul')");
echo "@h1>Data berhasil diupdate@h1>";
echo "@br>@a href=form_buku.php>Kembali Ke Form Buku>/a>";
?>

Index(Form)

@html>
@head>@title>STMIK Kharisma Karawang@/title>
@link href="file.css" rel="stylesheet" type="text/css">

@frameset rows="20%,70%,10%" border="">
@frame name="awal" src="judul.php" scrolling="no">

@frameset cols="20%, 65%, 15% border="">
@frame name="navigasi" src="menu.php" scrolling="no">
@frame name="isi" src="profile.php" scrolling="no">
@frame name="pelengkap" src="pelengkap.php" scrollling="no">
@/frameset>

@frame name="bawah" src="bawah.php" scrolling="no">
@/frameset>
@/head>
@body>
@/body>
@/html>

Kamis, 28 Januari 2010

Index (PHP)


@?php
#include('mode.css');
echo'@head>';
echo'@meta http-equiv="refresh" name="keywords" content="stmik-kharisma">';
echo'@title>Pelatihan Pemrograman Web, STMIK Kharisma Karawang@/title>';
echo'@frameset rows="20%, *" border="0">';

echo'@frame name="frame-judul" src="judul.php" scroling="no">';
echo'@frameset cols="25%, 60%, 15%" border="0" scroling="no">';
echo'@frame name="frame_menu" src="menu.php" sroling="no">';
echo'@frame name="frame_isi" src="profile.php" scroling="no">';
echo'@frame name="frame_plk" src="plk.php" sroling="no">';
echo'@/frameset>';
echo'@/frameset>';
echo'@/head>'
?>