Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.02 KB | None | 0 0
  1. <?php
  2.  
  3. defined('BASEPATH') OR exit('No direct script access allowed');
  4.  
  5. class Include_service extends CI_CONTROLLER {
  6.    
  7.     public function __construct()
  8.     {
  9.         parent::__construct();
  10.        
  11.     }
  12.    
  13.     public function index()
  14.     {
  15.         if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) AND strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
  16.             if(!$this->input->post('category')) {
  17.                 exit("Not Access");
  18.             }
  19.             if(empty($this->input->post('category'))) {
  20.                 exit('<option value="0">Select Category</option>');
  21.             }
  22.             $input_cat = $this->db->escape_str($this->input->post('category'));
  23.             $service = $this->db->get_where('services', ['category' => $input_cat])->result_array();
  24.             print('<option value="">Select One</option>');
  25.             foreach($service as $x) {
  26.                 print('<option value="'.$x["id"].'">'.$x["id"].'</option>');
  27.             }
  28.         } else {
  29.             exit("Not Access");
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement