在Database - codeigniter中选择Option None插入None

时间:2016-06-20 09:31:33

标签: php jquery mysql ajax codeigniter

我已在codeigniter视图中使用jquery ajax填充了选项。当我从B类型中选择Village时,会填充Category选择选项,选择District会向我DistrictTehsils会给我{{1} }}。问题在于tehsils选择选项,它会在数据库中插入Union Councils,但不会插入其实际值。喜欢 union council。  下面是我的代码和图片。请帮我。感谢。

控制器

None

模型

INSERT INTO 'hazara_tbl' ('HName', 'HDescription', 'Latitude', 'Longitude', 'CatagoryType', 'ParentID') VALUES ('ABC', 'blalbala', '123', '345', 'Village', 'None')

查看

public function create_main()
{
    if(!empty($_POST))
    {
        $this->load->model('insert_data_model');
        $query = $this->insert_data_model->add();
        $data = $this->db->last_query();
        print_r($data);
        exit();
        redirect('insert_data/index/');
    } 
    else 
    {
        $this->load->model('insert_data_model');
        $data['getDistt'] = $this->insert_data_model->getDisttforTehsil();
        $this->load->view('insertManual/main_insert', $data);
    }
public function getTehsilsForDistt($id="")
{
    $new =  $_POST['id'];
    $id = $this->input->post('HID');
    $data['query'] = $this->db->query("SELECT `HID`, `HName` FROM hazara_tbl WHERE `ParentID` = '".$new."' AND `CatagoryType` = 'Tehsil' ")->result();
    echo json_encode($data);
}
public function getUCForTehsils($idV="")
{
    $newV =  $_POST['idV'];
    $idV = $this->input->post('HID'); //receiving the ajax post from view
    $data['Vquery'] = $this->db->query("SELECT `HID`, `HName` FROM hazara_tbl WHERE `ParentID` = '".$newV."' AND `CatagoryType` = 'Union Council' ")->result();
    echo json_encode($data);
}
}

View

Output

0 个答案:

没有答案