Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'config/konek.php';
- echo "<script type='text/javascript'>
- function cek_tipe(val){
- if(val=='1'){
- document.getElementById('cari_tanggal').style.display='block';
- document.getElementById('cari_materi').value='';
- document.getElementById('cari_materi').style.display='none';
- }else if(val=='2'){
- document.getElementById('cari_materi').style.display='block';
- document.getElementById('cari_tanggal').value='';
- document.getElementById('cari_tanggal').style.display='none';
- }
- }
- </script>";
- echo "<h1><center>Training</center></h1>";
- echo "<form name='f1' method=POST action=?module=cari>
- <input type='radio' name='pilih' id='pilih' value='1' onclick=\"cek_tipe(this.value);\"> Tanggal
- <input type='radio' name='pilih' id='pilih' value='2' onclick=\"cek_tipe(this.value);\"> Materi
- <br>
- <div id='cari_tanggal' style='display:none;'>Cari Tanggal Mulai : <input type='text' name='tanggal' size='10'></div>
- <div id='cari_materi' style='display:none;'>Cari Materi : <input type='text' name='materi' size='10'></div>
- <input type='submit' name='cari' value='Cari'>
- </form>";
- if ($_POST[materi]== NULL) {
- $cari =mysql_query ("select * from plan where TGL_MULAI = '$_POST[tanggal]'");
- echo "<table border=1>
- <tr><th>Kode Plan</th>
- <th>NAMA TRAINING</th>
- <th>LC</th><th>Instruktur</th>
- <th>Ubis</th><th>Angkatan</th>
- <th>Tanggal Mulai</th>
- <th>Tanggal akhir</th>
- <th>Anggaran</th>
- <th>Peserta</th></tr>";
- $i=1;
- while ($r=mysql_fetch_array($cari)){
- echo " <tr><td>$r[KODE_PLAN]</td><td>$r[NAMA_M_TRAINING]</td><td>$r[KODE_LC]</td><td>$r[KODE_INST]</td><td>$r[KODE_UBIS]</td><td>$r[ANGKATAN]</td><td>$r[TGL_MULAI]</td><td>$r[TGL_AKHIR]</td><td>$r[ANGGARAN]</td><td>$r[PST]</td></tr>";
- $i++;
- }
- echo "</table>";
- }
- else if ($_POST[tanggal]== NULL ) {
- $cari = trim(strtolower($_POST['materi']));
- $sql="SELECT * FROM plan WHERE lower(NAMA_M_TRAINING) LIKE '%''$cari''%'";
- $r=mysql_query ($sql)or die(mysql_error());
- //echo $cari;
- echo "<table border=1>
- <tr><th>Kode Plan</th>
- <th>NAMA TRAINING</th>
- <th>LC</th><th>Instruktur</th>
- <th>Ubis</th><th>Angkatan</th>
- <th>Tanggal Mulai</th>
- <th>Tanggal akhir</th>
- <th>Anggaran</th>
- <th>Peserta</th></tr>";
- while ($t=mysql_fetch_array($r)){
- echo " <tr><td>$r[KODE_PLAN]</td><td>$r[NAMA_M_TRAINING]</td><td>$r[KODE_LC]</td><td>$r[KODE_INST]</td><td>$r[KODE_UBIS]</td><td>$r[ANGKATAN]</td><td>$r[TGL_MULAI]</td><td>$r[TGL_AKHIR]</td><td>$r[ANGGARAN]</td><td>$r[PST]</td></tr>";
- }
- echo "</table>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment