Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在php中为数组返回空值_Php_Mysql_Codeigniter - Fatal编程技术网

在php中为数组返回空值

在php中为数组返回空值,php,mysql,codeigniter,Php,Mysql,Codeigniter,我试图从下拉列表中获取多个输入,但返回的是no值。随函附上代码: 控制器:- public function mark_error($id = null, $email=null) { if($this->userlib->isLoggedIn()) { if($this->userlib->isAdmin()) { $seller_error = $this->input->post('

我试图从下拉列表中获取多个输入,但返回的是no值。随函附上代码: 控制器:-

public function mark_error($id = null, $email=null)
{
    if($this->userlib->isLoggedIn())
    {
        if($this->userlib->isAdmin())
        {
            $seller_error = $this->input->post('seller_error');
            if(is_null($seller_error))
            {
                $seller_error = array();
            }
            $marked_error_seller = implode(',', $seller_error);

            $bank_error = $this->input->post('bank_error');
            if(is_null($bank_error))
            {
                $bank_error = array();
            }
            $marked_error_bank = implode(',', $bank_error);

            $store_error = $this->input->post('store_error');
            if(is_null($store_error))
            {
                $store_error = array();
            }
            $marked_error_store = implode(',', $store_error);

            $id2 = $this->userlib->getId();
            $data['admin_data'] = $this->admin_panel_model->admin_data($id2);

            $data['marked_error_seller']=$marked_error_seller;
            $data['marked_error_store']=$marked_error_store;
            $data['marked_error_bank']=$marked_error_bank;
            $data['email']=$email;

            $this->admin_panel_model->mark_error_seller($id, $marked_error_seller);
            $this->admin_panel_model->mark_error_bank($id, $marked_error_bank);
            $this->admin_panel_model->mark_error_store($id, $marked_error_store);                               
            $this->load->view('send_mail', $data);
        }
        else
        {
            echo "User not Allowed";
        }
    }
    else
    {
        echo "User not Logged In";
    }
}
型号:-

public function mark_error_seller($id, $marked_error_seller)
{
    $data = array('marked_error_seller'=>$marked_error_seller, 'seller_status'=>2);
    $this->db->update($this->seller_table, $data, array('id'=>$id));
    $status = array('error_status'=>1, 'admin_check'=>8);
    $this->db->update($this->table, $status, array('id'=>$id));
}

public function mark_error_bank($id, $marked_error_bank)
{
    $data1 = array('marked_error_bank'=>$marked_error_bank, 'bank_status'=>2);
    $this->db->update($this->bank_table, $data1, array('id'=>$id));
    $status = array('error_status'=>1, 'admin_check'=>8);
    $this->db->update($this->table, $status, array('id'=>$id)); 
}

public function mark_error_store($id, $marked_error_store)
{
    $data2 = array('marked_error_store'=>$marked_error_store, 'store_status'=>2);
    $this->db->update($this->store_table, $data2, array('id'=>$id));
    $status = array('error_status'=>1, 'admin_check'=>8);
    $this->db->update($this->table, $status, array('id'=>$id));
}
视图:-

 <form action= "<?=site_url('admin_panel/mark_error/'.$id.'/'.$email)?>" method="post" enctype="multipart/form-data">
                          <div class="box-body">
                            <label>Seller Details</label>
                            <select name="seller_error[]" style = "width : 100%;" multiple="multiple" id="travel_lst" placeholder="">
                                    <option value="Business_Name">Business Name</option>
                                    <option value="Business+Address">Business Address</option>
                                    <option value="Mobile">Mobile</option>
                                    <option value="City">City</option>
                                    <option value="State">State</option>
                                    <option value="Pincode">Pincode</option>
                                    <option value="PAN">PAN</option>
                                    <option value="PAN_Proof">PAN Proof</option>
                                    <option value="TAN">TAN</option>
                                    <option value="TIN">TIN</option>
                                    <option value="TIN_Proof">TIN Proof</option>
                                    <option value="STRN">STRN</option>
                                    <option value="STRN_Proof">STRN Proof</option>
                                    <option value="Residence_Address">Residence Address</option>
                                </select>
                                <label>Bank Details</label>
                                <select name="bank_error[]" style = "width : 100%;" multiple="multiple" id="travel_lst" placeholder="">
                                    <option value="Beneficiary Name">Beneficiary Name</option>
                                    <option value="Bank Account Number">Bank Account Number</option>
                                    <option value="IFSC Code">IFSC Code</option>
                                    <option value="MICR Number">MICR Number</option>
                                    <option value="Bank Name">Bank Name</option>
                                    <option value="City">City</option>
                                    <option value="Branch">Branch</option>
                                    <option value="Cancelled Cheque">Cancelled Cheque</option>
                                    <option value="Address Proof">Address Proof</option>
                                    <option value="Type of Address Proof">Type of Address Proof</option>
                                    <option value="Identity Proof">Identity Proof</option>
                                    <option value="Type of Identity Proof">Type of Identity Proof</option>

                                </select>
                                <label>Store Details</label>
                                <select name="store_error[]" style = "width : 100%;" multiple="multiple" id="travel_lst" placeholder="">
                                    <option value="Billboard Image">Billboard Image</option>
                                    <option value="Company Display Name">Company Display Name</option>
                                    <option value="Company Description">Company Description</option>
                                    <option value="Company Logo">Company Logo</option>
                                    <option value="Travel Category">Travel Category</option>
                                    <option value="Travel Sub Category">Travel Sub Category</option>
                                    <option value="Travel Region">Travel Region</option>

                                </select>
                          </div>
                          <!-- /.box-body -->
                          <div class="box-footer">
                        <?php endforeach;?>
                            <input type="submit" class="btn btn-primary" value="Submit">
                          </div>
                        </form>
试试这个

在控制器中

public function mark_error($id = null, $email=null)
{
    if($this->userlib->isLoggedIn())
    {
        if($this->userlib->isAdmin())
        {

            $seller     = $this->input->post('seller_error');
            $bank   = $this->input->post('bank_error');
            $store  = $this->input->post('store_error');

            if (empty($seller) || empty($bank) || empty($store)) {
                echo "Field(s) is(are) Empty";
            }
            else
            {
                $id2 = $this->userlib->getId();
                if (empty($id2)) {
                    echo "ID Field is empty";
                }
                else
                {
                    $this->admin_panel_model->mark_error_seller($id, $seller);
                    $this->admin_panel_model->mark_error_bank($id, $bank);
                    $this->admin_panel_model->mark_error_store($id, $store);  

                    $data['admin_data'] = $this->admin_panel_model->admin_data($id2);  

                    $this->load->view('send_mail', $data);                  
                }
            }
        }
        else
        {
            echo "User not Allowed";
        }
    }
    else
    {
        echo "User not Logged In";
    }
}
在型号中

public function mark_error_seller($id, $seller)
{
    $data = array(
       'marked_error_seller' => $seller,
       'seller_status' => '2',
       'error_status' => '1',
       'admin_check' => '8'
    );
    $this->db->where('id', $id);
    $this->db->update('seller', $data); # I assume tabe name is seller
}

public function mark_error_bank($id, $bank)
{
    $data = array(
       'marked_error_bank' => $bank,
       'bank_status' => '2',
       'error_status' => '1',
       'admin_check' => '8'
    );
    $this->db->where('id', $id);
    $this->db->update('bank', $data); # I assume tabe name is bank
}

public function mark_error_store($id, $store)
{
    $data = array(
       'marked_error_store' => $store,
       'store_status' => '2',
       'error_status' => '1',
       'admin_check' => '8'
    );
    $this->db->where('id', $id);
    $this->db->update('store', $data); # I assume tabe name is store
}

你能告诉我这个
$this->table上包含什么吗
$this->table是数据库中名为“seller”的表吗?你能给出所有的表名吗??所以这个
$status=array('error\u status'=>1,'admin\u check'=>8)
$data=array('marked\u error\u seller'=>$marked\u error\u seller,'seller\u status'=>2)此更新到同一个表中??不,它们都是不同的表这是一个多选下拉列表,因此我将通过post方法获取一个数组,并需要将其转换为字符串,因此您建议的方法需要进行此更正。@AjitejKaushik您检查了吗?先生,我有点忙于与我的项目相关的其他工作,我明天会测试它的sure@AjitejKaushik好的,慢慢来。别忘了接受并投票表决