【发布时间】:2018-11-17 07:39:18
【问题描述】:
我有两个单选按钮和一个复选框。如果单选按钮被选中,我想加载一个视图页面(Receipt_view)如果单选按钮和复选框都被选中,我想加载另一个视图页面(Receipt_View1) ...我的问题是,如果同时选中单选按钮和复选框,我将输出作为 2 个视图页面(即两个视图页面都加载了 Receipt_view 和 Receipt_view 1 ),但我希望 Receipt_view1 在两个视图页面都加载时加载单选按钮和复选框被选中.. 控制器代码:
if ($this->input->post('all'))
{
$this->db->where('date >=', $newDate);
$this->db->where('date <=', $newDate2);
$this->db->select('*');
$this->db->from('purchasebill');
$this->db->order_by("date", "asc");
$this->db->join('parmaster','parmaster.Pcode = purchasebill.partyname','left outer');
$query = $this->db->get()->result_array();
$data['query'] = $query;
$this->load->view('Receipt_View', $data);
}
if($this->input->post('all'))
{
if($this->input->post('item')){
if ($this->input->post('all'))
{
if($this->input->post('item')){
$this->db->where('billdate >=', $newDate);
$this->db->where('billdate <=', $newDate2);
$this->db->select('vno,Prdtname,Qty,bundle');
$this->db->from('purchaseitem');
$this->db->order_by("vno", "asc");
//$this->db->join('purchasebill', 'purchasebill.no = purchaseitem.billno','left outer');
//$this->db->join('parmaster','parmaster.pcode = purchasebill.partyname');
$this->db->join('itemmaster','itemmaster.itcode = purchaseitem.Product_Code','left outer');
$query = $this->db->get('')->result_array();
$data['query'] = $query;
$this->db->where('date >=', $newDate);
$this->db->where('date <=', $newDate2);
$this->db->select();
$this->db->from('purchasebill');
$this->db->order_by('voucherno');
$this->db->group_by('voucherno');
$this->db->join('parmaster','parmaster.Pcode = purchasebill.partyname','left outer');
$query = $this->db->get('')->result_array();
$data['query1'] = $query;
$this->load->view('Receipt_View1',$data);
}}
if($this->input->post('selected'))
{
if($name = $this->input->post('businessType'))
{
$this->db->where('date >=', $newDate);
$this->db->where('date <=', $newDate2);
$this->db->where('PName',$name);
$this->db->select('*');
$this->db->from('purchasebill');
$this->db->order_by("date", "asc");
//$this->db->join('salesbill', 'salesbill.no = salesitem.billno','left outer');
$this->db->join('parmaster','parmaster.Pcode = purchasebill.partyname','left outer');
$query = $this->db->get('')->result_array();
$data['query'] = $query;
$this->load->view('Receipt_View', $data);
}
}
HTML页面:
<input type="radio" class='rd'name="all" value="op1" checked="">All
<input type="radio" name="selected" class='rd' value="op2"> Selected
<input type="checkbox" name="item" >Item description
All and selected 是单选按钮名称,item 是复选框名称..帮我解决这个问题..
【问题讨论】:
标签: php codeigniter if-statement