SHARE
TWEET

Untitled

a guest Jun 20th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.      
  3. <form action="" method="get">
  4.         <input id="searchfield-cmgv" type="text" name="hoten" placeholder="Họ và tên tư vấn viên...." size="35" value="<?=$_REQUEST['hoten']?>"/>
  5.         <!-- location-->
  6.         <select name="location">
  7.             <option value="">-------- Tỉnh/TP --------</option>
  8.             <option value="Hà Nội" <?php if($_REQUEST['location']=='Hà Nội') echo 'selected';?> >Hà Nội</option>
  9.             <option value="TP Hồ Chí Minh" <?php if($_REQUEST['location']=='TP Hồ Chí Minh') echo 'selected';?> >TP Hồ Chí Minh</option>
  10.             <!-- <option value="Huế" <?php if($_REQUEST['location']=='Huế') echo 'selected';?> >Huế</option>-->
  11.             <option value="Đà Nẵng" <?php if($_REQUEST['location']=='Đà Nẵng') echo 'selected';?> >Đà Nẵng</option>
  12.             <option value="Hải Phòng" <?php if($_REQUEST['location']=='Hải Phòng') echo 'selected';?> >Hải Phòng</option>
  13.             <option value="Đồng Nai" <?php if($_REQUEST['location']=='Đồng Nai') echo 'selected';?> >Đồng Nai</option>
  14.             <!-- <option value="Đồng Tháp">Đồng Tháp</option>
  15.             <option value="Gia Lai">Gia Lai</option> -->
  16.             <option value="Hà Giang" <?php if($_REQUEST['location']=='Hà Giang') echo 'selected';?> >Hà Giang</option>
  17.             <!-- <option value="Hà Nam">Hà Nam</option>
  18.             <option value="Hà Tĩnh">Hà Tĩnh</option> -->
  19.             <option value="Hải Dương" <?php if($_REQUEST['location']=='Hải Dương') echo 'selected';?> >Hải Dương</option>
  20.             <option value="Nghệ An" <?php if($_REQUEST['location']=='Nghệ An') echo 'selected';?> >Nghệ An</option>
  21.             <option value="Thái Nguyên" <?php if($_REQUEST['location']=='Thái Nguyên') echo 'selected';?> >Thái Nguyên</option>
  22.             <option value="Yên Bái" <?php if($_REQUEST['location']=='Yên Bái') echo 'selected';?> >Yên Bái</option>
  23.  
  24.        </select>
  25.        <select name="company">
  26.            <option value="">-------- Công ty --------</option>
  27.            <option value="Prudential" <?php if($_REQUEST['company']=='Prudential') echo 'selected';?> >Prudential</option>
  28.            <option value="Manulife" <?php if($_REQUEST['company']=='Manulife') echo 'selected';?> >Manulife</option>
  29.            <option value="AIA" <?php if($_REQUEST['company']=='AIA') echo 'selected';?> >AIA</option>
  30.            <option value="Dai-ichi Life" <?php if($_REQUEST['company']=='Dai-ichi Life') echo 'selected';?> >Dai-ichi Life</option>
  31.            <option value="ACE Life" <?php if($_REQUEST['company']=='ACE Life') echo 'selected';?> >ACE Life</option>
  32.            <option value="Bảo Việt" <?php if($_REQUEST['company']=='Bảo Việt') echo 'selected';?> >Bảo Việt</option>
  33.            <option value="Hanwha Life" <?php if($_REQUEST['company']=='Hanwha Life') echo 'selected';?> >Hanwha Life</option>
  34.            <option value="Generali" <?php if($_REQUEST['company']=='Generali') echo 'selected';?> >Generali</option>
  35.            <option value="Chưa có" <?php if($_REQUEST['company']=='Chưa có') echo 'selected';?> >Chưa có</option>
  36.        </select>
  37.         <input type="hidden" value="true" name="confirm" />
  38.        <input id="searchbutton" value="Tìm kiếm" type="submit">
  39.     </form>
  40.  
  41.        <?php
  42.        global $wpdb;
  43.  
  44.         // lấy thông tin công ty, họ tên, location
  45.         $company = $_GET['company'];
  46.         $hoten = $_GET['hoten'];
  47.         $location = $_GET['location'];
  48.  
  49.     if(!$company && !$hoten && !$location){
  50.  
  51.             // string query
  52.             $strquery = '
  53.                                     SELECT bh_blogs.blog_id
  54.                                     FROM bh_blogs
  55.                                     WHERE bh_blogs.blog_id >1
  56.                                     AND bh_blogs.deleted =0
  57.                                     ORDER BY bh_blogs.voted DESC        
  58.             ';
  59.  
  60.             // get result
  61.             $res = $wpdb->query($strquery);
  62.  
  63.             // display result
  64.             //
  65.             //
  66.     } else {
  67.        //var_dump($location); var_dump($company); var_dump($hoten);
  68.         $strquery = '
  69.             SELECT bh_blogs.blog_id
  70.             FROM bh_blogs
  71.             WHERE bh_blogs.blog_id > 1 AND bh_blogs.deleted =0 ';
  72.  
  73.         if($hoten!='') $strquery .= ' AND bh_blogs.site_name LIKE "%'.$hoten.'%" ';
  74.         if($company!='') $strquery .= ' AND bh_blogs.company="'.$company.'" ';
  75.         if($location!='') $strquery .= ' AND bh_blogs.location="'.$location.'" ';
  76.  
  77.         $strquery .= ' ORDER BY bh_blogs.voted DESC ';
  78.  
  79.         //display result
  80.         //
  81.         //
  82.     }  
  83.  
  84. get_footer();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top