Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Searching</title>
- <style type="text/css">
- body {font-family:calibri,arial,sans-serif:12pt;}
- .container {width:500px;background-color:#ffc;-moz-box-shadow:2px 2px 8px rgba(0,0,0,0.5);-webkit-box-shadow:2px 2px 8px rgba(0,0,0,0.5);padding:3px;-webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px;}
- .error {font-weight:bold;color:#900;background-color:#e99;width:100%;padding:4px 10px;text-align:center;}
- .keyword {font-weight:bold;color:#009;background-color:#ffc;}
- input,select {font-family:calibri,arial,sans-serif; font-size:12px;padding:3px;-webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px;border: solid 1 px #999;color:#333;background-color:#ff9;}
- </style>
- </head>
- <body>
- <header>
- <img src="qasystem.gif" alt="Question Answering FTI UNISBANK" />
- <form method="post" name="pencarian" id="pencarian">
- CARI
- <select name="pilihan" id="pilihan">
- <option value="siapa">siapa</option>
- <option value="apa">apa</option>
- </select>
- <input type="text" name="search" id="search" size="150" maxlength="250" />
- <input type="submit" name="submit" id="submit" value="CARI" />
- </form>
- </header>
- <div class="container">
- <?php
- $dbhost='localhost';
- $dbuser='root';
- $dbpass='';
- $dbname='QAS'
- $db=new mysqli($dnhost,$dbuser,$dbpass,$dbname);
- $msg='';
- if(isset($_POST['submit']))
- {
- $search=isset($_POST['search'])?$_POST['search']:'';
- $pilihan=isset($_POST['pilihan'])?$_POST['pilihan']:'';
- if(!empty($search))
- {
- if($pilihan=='siapa')
- {
- $sql="SELECT nama,pertanyaan "
- ."FROM jabatan "
- ."WHERE nama LIKE '%$search%' ";
- if($result=$db->query($sql))
- {
- if($result->num_rows>0)
- {
- $msg.="<div class='hasil'>"
- ."Data yang anda cari adalah "
- ."<span class='keyword'>".$search."</span>"
- .", dan terdapat [<b>".$result->num_rows."</b>] data yang sesuai."
- ."<hr>\n";
- while($row=$result->fetch_object())
- {
- $msg.=$row->nama.', Jabatannya adalah ===>> '.$row->pertanyaan."<hr/>\n";
- }
- $msg.="</div>\n";
- }
- else
- {
- $msg.="<div class='error'>Maaf, hasil pencarian tidak ditemukan</div>\n";
- }
- }
- }
- elseif($pilihan=='apa')
- {
- $sql="SELECT pertanyaan,visi_misi "
- ."FROM visi_misi "
- ."WHERE pertanyaan LIKE '%$search%' ";
- if($result=$db->query($sql))
- {
- if($result->num_rows>0)
- {
- $row=$result->fetch_object();
- $msg.="<div class='hasil'>"
- ."Data yang anda cari adalah "
- ."<span class='keyword'>".$search."</span>"
- .", dan terdapat [<b>".$result->num_rows."</b>] data yang sesuai."
- ."<hr />\n";
- while($row=$result->fetch_object())
- {
- $msg.=$row->pertanyaan.', Visi Misinya adalah ===>> '.$row->visi_misi."<hr/>\n";
- }
- $msg.="</div>\n";
- }
- else
- {
- $msg.="<div class='error'>Maaf, hasil pencarian tidak ditemukan</div>\n";
- }
- }
- }
- }
- else
- {
- $msg.="<div class='error'>Masukkan dulu kata kuncinya</div>\n";
- }
- echo $msg;
- }
- ?>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement