我想從下拉列表中獲取多個輸入,但它返回一個沒有值。附後是代碼: 控制器: -在php中返回數組的空值
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>
闡述,狀態在數據庫中,但成功更改來自三個下拉列表的輸入沒有被更新,請幫助。
你能告訴我什麼包含在這個'$這個 - > table' –
$這個 - >表是數據庫中的名稱爲「賣家」的表 –
可以給所有表名S 17所以這個$ status = array('error_status'=> 1,'admin_check'=> 8);''和'$ data = array('marked_error_seller'=> $ marked_error_seller,'seller_status'=> 2);'這個更新放入同一張桌子? –