Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <head>
- <link type="text/css" href="../js/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" />
- <script type="text/javascript" src="../js/jquery-1.7.2.js"></script>
- <script type="text/javascript" src="../js/jquery-ui-1.8.20.cust*m.min.js"></script>
- <script type="text/javascript" src="../js/jquery.validate.js"></script>
- <script language="javascript">
- $(document).ready(function()
- {
- $("#kamarc").blur(function()
- {
- //remove all the class add the messagebox classes and start fading
- $("#msgbox").removeClass().text('Checking...').fadeIn("slow");
- //check the username exists or not from ajax
- $.post("cek_kamar.php",{no_kamar:$(this).val() } ,function(data)
- {
- if(data=="no") //if username not avaiable
- {
- $("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
- {
- //add message and change the class of the box and start fading
- $(this).html("Kamar Sudah Di tempati").fadeTo(900,1);
- });
- }
- elseif(data=="yes") //if username not avaiable
- {
- $("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
- {
- //add message and change the class of the box and start fading
- $(this).html("Kamar Masih Kosong").fadeTo(900,1);
- });
- }
- });
- });
- });
- </script>
- <script>
- $(document).ready(function(){
- $("#penghuni").validate({
- rules: {
- nama: {
- required: true,
- minlength: 3
- },
- pass:{
- required:true,
- minlength:5
- },
- kamarc:{
- required: if(data=="no")
- },
- },
- messages: {
- nama: {
- required: "Kolom nama harus diisi",
- minlength: "Kolom nama minimal terdiri 3 karakter"
- },
- pass: {
- required: "Kolom password harus diisi",
- minlength: "Kolom password minimal terdiri 5 karakter"
- },
- },
- submitHandler: function(form){
- $(form).ajaxSubmit({
- dataType: "xml",
- resetForm: true,
- success: function(data){
- alert("Data telah disimpan");
- }
- });
- }
- });
- });
- $(document).ready(function()
- {
- $("#kamar").blur(function()
- {
- //remove all the class add the messagebox classes and start fading
- $("#msgbox").removeClass().addClass('messagebox').text('Checking...').fadeIn("slow");
- //check the username exists or not from ajax
- $.post("cek_kamar.php",{no_kamar:$(this).val() } ,function(data)
- {
- if(data=='no') //if username not avaiable
- {
- $("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
- {
- //add message and change the class of the box and start fading
- $(this).html('Nama Sudah Ada').addClass('messageboxerror').fadeTo(900,1);
- });
- }
- else
- {
- $("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
- {
- //add message and change the class of the box and start fading
- $(this).html('Nama Tersedia ').addClass('messageboxok').fadeTo(900,1);
- $(this).focus();
- });
- }
- });
- });
- });
- </script>
- </head>
- <body>
- <h2>Input Penghuni </h2>
- <form action="penghunisim.php" method="post" enctype="multipart/form-data" name="penghuni" id="penghuni" class="cmxForm">
- <table width="725" border=0>
- <tr>
- <td width="213">Nama</td>
- <td width="502">:
- <input name="nama" type="text" id="cnama" class="required" title="nama tidak boleh kosong!"></td>
- </tr>
- <tr>
- <td>User</td>
- <td>:
- <input name="user" type="text" id="user" class="required" title="user tidak boleh kosong!"></td>
- </tr>
- <tr>
- <td>Password</td>
- <td>:
- <input name="pass" type="text" id="pass" class="required" title="password harus diisi!"></td>
- </tr>
- <tr>
- <td>Alamat Asli</td>
- <td>:
- <textarea name="alamat" id="alamat" cols="45" rows="5"></textarea></td>
- </tr>
- <tr>
- <td>No.Telp</td>
- <td>:
- <input type="text" name="notelp" id="notelp"></td>
- </tr>
- <tr>
- <td>Kampus</td>
- <td>:
- <select name="kampus" id="kampus" class="required" title="kampus harus dipilih!">
- <option> </option>
- <?php include '../config/koneksi.php';
- $tampil=mysql_query("select * from kampus order by id_kampus");
- while($r=mysql_fetch_array($tampil)){
- echo "<option value=$r[id_kampus]>$r[kampus]</option>";
- } ?>
- </select></td>
- </tr>
- <tr>
- <td>Jurusan</td>
- <td>:
- <select name="jurusan" id="jurusan" class="required" title="jurusan wajib diisi !">
- <option></option>
- <?php include '../config/koneksi.php';
- $tampil=mysql_query("select * from jurusan order by kd_jurusan");
- while($r=mysql_fetch_array($tampil)){
- echo "<option value=$r[kd_jurusan]>$r[jurusan]</option>";
- } ?>
- </select></td>
- </tr>
- <tr>
- <td>Tgl Masuk Asrama</td>
- <td>:
- <select name="tanggal" class="required" title=" diisi!">
- <option> </option>
- <?php
- for($hr=1; $hr<32 ; $hr++)
- {
- echo"<option value='$hr'>$hr</option>";
- }
- ?>
- </select>
- -
- <select name="bulan" class="required" title="diisi dulu">
- <option> </option>
- <option value="01">Januari</option>
- <option value="02">Februari</option>
- <option value="03">Maret</option>
- <option value="04">April</option>
- <option value="05">Mei</option>
- <option value="06">Juni</option>
- <option value="07">Juli</option>
- <option value="08">Agustus</option>
- <option value="09">September</option>
- <option value="10">Oktober</option>
- <option value="11">November</option>
- <option value="12">Desember</option>
- </select>
- -
- <select name="tahun" class="required" title="diisi dulu">
- <option> </option>
- <?php
- $year=date("Y");
- for($th=2007; $th<2015; $th++)
- {
- echo" <option value='$th'>$th</option>";
- }
- ?>
- </select></td>
- </tr>
- <tr>
- <td>Tgl Masuk Kuliah</td>
- <td>:
- <select name="tanggal2" class="required" title=" diisi!">
- <option> </option>
- <?php
- for($hr=1; $hr<32 ; $hr++)
- {
- echo"<option value='$hr'>$hr</option>";
- }
- ?>
- </select>
- -
- <select name="bulan2" class="required" title="diisi dulu">
- <option> </option>
- <option value="01">Januari</option>
- <option value="02">Februari</option>
- <option value="03">Maret</option>
- <option value="04">April</option>
- <option value="05">Mei</option>
- <option value="06">Juni</option>
- <option value="07">Juli</option>
- <option value="08">Agustus</option>
- <option value="09">September</option>
- <option value="10">Oktober</option>
- <option value="11">November</option>
- <option value="12">Desember</option>
- </select>
- -
- <select name="tahun2" class="required" title="diisi dulu">
- <option> </option>
- <?php
- $year=date("Y");
- for($th=2007; $th<2015; $th++)
- {
- echo" <option value='$th'>$th</option>";
- }
- ?>
- </select></td>
- </tr>
- <tr>
- <td>Kamar</td>
- <td>:
- <select name="kamar" id="kamarc" class="required" title="kamar diisi !">
- <option></option>
- <?php include '../config/koneksi.php';
- $tampil=mysql_query("select * from kamar order by no_kamar");
- while($r=mysql_fetch_array($tampil)){
- echo "<option value=$r[no_kamar]>$r[no_kamar]</option>";
- } ?>
- </select>
- <span id="msgbox" style="display:none"></span>
- </td>
- </tr>
- <tr>
- <td>Foto</td>
- <td>:
- <input name="foto" type="file" id="foto" class="required" title="foto wajib diisi"></td>
- </tr>
- <tr>
- <td> </td>
- <td><input type="submit" name="button" id="button" value="Simpan"></td>
- </tr>
- </table>
- <hr>
- </form>
- </div>
- </body>
- <h2>Data Penghuni</h2>
- <table width="576" border="1">
- <tr>
- <td width="47" align="center"><strong>No</strong></td>
- <td width="96" align="center"><strong>No ID </strong></td>
- <td width="84" align="center"><strong>Nama</strong></td>
- <td width="110" align="center"><strong>No Kamar </strong></td>
- <td align="center" colspan="4"><strong>Aksi</strong></td>
- </tr>
- <?php
- include '../config/koneksi.php';
- $file=$_SERVER['PHP_SELF'];
- include "class_paging.php";
- $p = new Paging;
- $batas = 10;
- $posisi = $p->cariPosisi($batas);
- $sql="SELECT * from penghuni where status='penghuni' order by no_kamar limit $posisi,$batas";
- $qry =mysql_query($sql);
- $no=$posisi+1;
- while($r=mysql_fetch_array($qry)){
- $ni++;
- ?>
- <tr>
- <td align="center"><?php echo $ni ?>.</td>
- <td align="center"><?php echo $r[id_penghuni] ?></td>
- <td><?php echo $r[nama] ?></td>
- <td align="center"><?php echo $r[no_kamar] ?></td>
- <td width="115" align="center"><a href="media.php?p=penghunidet&id=<?php echo $r[id_penghuni] ?>">Detail</a></td>
- <td width="84" align="center"><a href="penghunidel.php?id=<?php echo $r[id_penghuni] ?>">Hapus</a></td>
- <td width="84" align="center"><a href="media.php?p=penghunieditalum&id=<?php echo $r[id_penghuni] ?>">Alumni</a></td>
- </tr>
- <?php } ?>
- </table>
- <?php
- $jmldata = mysql_num_rows(mysql_query("SELECT * FROM penghuni"));
- $jmlhalaman = $p->jumlahHalaman($jmldata, $batas);
- $linkHalaman = $p->navHalaman($_REQUEST[halaman], $jmlhalaman);
- echo $linkHalaman;
- ?>
- <p> </p>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement