How to load the view page according to the condition
i have two radio button and one check box..If the radio button alone is checked i want to load one view page(Receipt_view) if both radio button and check box is checked i want to load another view page(Receipt_View1)...My problem is if both radio button and check box is checked i get the output as 2 view pages(that is both the view pages are loaded both Receipt_view and Receipt_view 1 are loaded) but i want Receipt_view1 to be loaded when both the radio button and check box is checked..
Controller Code:
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 Page:
<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 is the radio button name and item is the check box name..Help me to solve this issue..
php codeigniter if-statement
add a comment |
i have two radio button and one check box..If the radio button alone is checked i want to load one view page(Receipt_view) if both radio button and check box is checked i want to load another view page(Receipt_View1)...My problem is if both radio button and check box is checked i get the output as 2 view pages(that is both the view pages are loaded both Receipt_view and Receipt_view 1 are loaded) but i want Receipt_view1 to be loaded when both the radio button and check box is checked..
Controller Code:
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 Page:
<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 is the radio button name and item is the check box name..Help me to solve this issue..
php codeigniter if-statement
add a comment |
i have two radio button and one check box..If the radio button alone is checked i want to load one view page(Receipt_view) if both radio button and check box is checked i want to load another view page(Receipt_View1)...My problem is if both radio button and check box is checked i get the output as 2 view pages(that is both the view pages are loaded both Receipt_view and Receipt_view 1 are loaded) but i want Receipt_view1 to be loaded when both the radio button and check box is checked..
Controller Code:
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 Page:
<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 is the radio button name and item is the check box name..Help me to solve this issue..
php codeigniter if-statement
i have two radio button and one check box..If the radio button alone is checked i want to load one view page(Receipt_view) if both radio button and check box is checked i want to load another view page(Receipt_View1)...My problem is if both radio button and check box is checked i get the output as 2 view pages(that is both the view pages are loaded both Receipt_view and Receipt_view 1 are loaded) but i want Receipt_view1 to be loaded when both the radio button and check box is checked..
Controller Code:
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 Page:
<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 is the radio button name and item is the check box name..Help me to solve this issue..
php codeigniter if-statement
php codeigniter if-statement
edited Nov 17 '18 at 8:16
dhara
asked Nov 17 '18 at 7:39
dharadhara
20314
20314
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
You haven't told us what happens when neither of them is checked, so I'm not mentioning this case here, but you can do something like:
if ($this->input->post('all')) {
//do something with purchasebill, no need to repeat the code
//check if the checkbox is checked:
if($this->input->post('item')) {
// do something with purchaseitem
$this->load->view('Receipt_View1',$data);
} else {
$this->load->view('Receipt_View',$data);
}
}
I have two radio buttons so i think i can't use this..
– dhara
Nov 17 '18 at 7:56
can you explain your comment in more detail? Show the html of the page and point us to the radiobuttons and the checkbox. In the question you mentioned one radio and one checkbox, am I correct?
– Alexey
Nov 17 '18 at 7:58
Sorry i mentioned it wrongly..i have added html page in my edited post
– dhara
Nov 17 '18 at 8:17
add a comment |
write functions in 'else' block , your not using 'else' with if condition..
Tried but getting 2 view pages as a result
– dhara
Nov 17 '18 at 8:28
add one more if condition inside if condition for load second view page
– suneeth
Nov 17 '18 at 10:10
Tried but it does not load any data..I get blank page as a result......
– dhara
Nov 17 '18 at 10:13
add a comment |
By using elseif and && operator we can load according to the condition
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);
}
else if(($this->input->post('all')) &&($this->input->post('item')))
{
$this->db->select('vno,Prdtname,Qty,bundle');
$this->db->from('purchaseitem');
$this->db->order_by("vno", "asc");
$this->db->join('itemmaster','itemmaster.itcode = purchaseitem.Product_Code','left outer');
$query = $this->db->get('')->result_array();
$data['query'] = $query;
$this->load->view('Receipt_View1',$data);
}}
else 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);
}
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53349242%2fhow-to-load-the-view-page-according-to-the-condition%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You haven't told us what happens when neither of them is checked, so I'm not mentioning this case here, but you can do something like:
if ($this->input->post('all')) {
//do something with purchasebill, no need to repeat the code
//check if the checkbox is checked:
if($this->input->post('item')) {
// do something with purchaseitem
$this->load->view('Receipt_View1',$data);
} else {
$this->load->view('Receipt_View',$data);
}
}
I have two radio buttons so i think i can't use this..
– dhara
Nov 17 '18 at 7:56
can you explain your comment in more detail? Show the html of the page and point us to the radiobuttons and the checkbox. In the question you mentioned one radio and one checkbox, am I correct?
– Alexey
Nov 17 '18 at 7:58
Sorry i mentioned it wrongly..i have added html page in my edited post
– dhara
Nov 17 '18 at 8:17
add a comment |
You haven't told us what happens when neither of them is checked, so I'm not mentioning this case here, but you can do something like:
if ($this->input->post('all')) {
//do something with purchasebill, no need to repeat the code
//check if the checkbox is checked:
if($this->input->post('item')) {
// do something with purchaseitem
$this->load->view('Receipt_View1',$data);
} else {
$this->load->view('Receipt_View',$data);
}
}
I have two radio buttons so i think i can't use this..
– dhara
Nov 17 '18 at 7:56
can you explain your comment in more detail? Show the html of the page and point us to the radiobuttons and the checkbox. In the question you mentioned one radio and one checkbox, am I correct?
– Alexey
Nov 17 '18 at 7:58
Sorry i mentioned it wrongly..i have added html page in my edited post
– dhara
Nov 17 '18 at 8:17
add a comment |
You haven't told us what happens when neither of them is checked, so I'm not mentioning this case here, but you can do something like:
if ($this->input->post('all')) {
//do something with purchasebill, no need to repeat the code
//check if the checkbox is checked:
if($this->input->post('item')) {
// do something with purchaseitem
$this->load->view('Receipt_View1',$data);
} else {
$this->load->view('Receipt_View',$data);
}
}
You haven't told us what happens when neither of them is checked, so I'm not mentioning this case here, but you can do something like:
if ($this->input->post('all')) {
//do something with purchasebill, no need to repeat the code
//check if the checkbox is checked:
if($this->input->post('item')) {
// do something with purchaseitem
$this->load->view('Receipt_View1',$data);
} else {
$this->load->view('Receipt_View',$data);
}
}
answered Nov 17 '18 at 7:53
AlexeyAlexey
2,09752037
2,09752037
I have two radio buttons so i think i can't use this..
– dhara
Nov 17 '18 at 7:56
can you explain your comment in more detail? Show the html of the page and point us to the radiobuttons and the checkbox. In the question you mentioned one radio and one checkbox, am I correct?
– Alexey
Nov 17 '18 at 7:58
Sorry i mentioned it wrongly..i have added html page in my edited post
– dhara
Nov 17 '18 at 8:17
add a comment |
I have two radio buttons so i think i can't use this..
– dhara
Nov 17 '18 at 7:56
can you explain your comment in more detail? Show the html of the page and point us to the radiobuttons and the checkbox. In the question you mentioned one radio and one checkbox, am I correct?
– Alexey
Nov 17 '18 at 7:58
Sorry i mentioned it wrongly..i have added html page in my edited post
– dhara
Nov 17 '18 at 8:17
I have two radio buttons so i think i can't use this..
– dhara
Nov 17 '18 at 7:56
I have two radio buttons so i think i can't use this..
– dhara
Nov 17 '18 at 7:56
can you explain your comment in more detail? Show the html of the page and point us to the radiobuttons and the checkbox. In the question you mentioned one radio and one checkbox, am I correct?
– Alexey
Nov 17 '18 at 7:58
can you explain your comment in more detail? Show the html of the page and point us to the radiobuttons and the checkbox. In the question you mentioned one radio and one checkbox, am I correct?
– Alexey
Nov 17 '18 at 7:58
Sorry i mentioned it wrongly..i have added html page in my edited post
– dhara
Nov 17 '18 at 8:17
Sorry i mentioned it wrongly..i have added html page in my edited post
– dhara
Nov 17 '18 at 8:17
add a comment |
write functions in 'else' block , your not using 'else' with if condition..
Tried but getting 2 view pages as a result
– dhara
Nov 17 '18 at 8:28
add one more if condition inside if condition for load second view page
– suneeth
Nov 17 '18 at 10:10
Tried but it does not load any data..I get blank page as a result......
– dhara
Nov 17 '18 at 10:13
add a comment |
write functions in 'else' block , your not using 'else' with if condition..
Tried but getting 2 view pages as a result
– dhara
Nov 17 '18 at 8:28
add one more if condition inside if condition for load second view page
– suneeth
Nov 17 '18 at 10:10
Tried but it does not load any data..I get blank page as a result......
– dhara
Nov 17 '18 at 10:13
add a comment |
write functions in 'else' block , your not using 'else' with if condition..
write functions in 'else' block , your not using 'else' with if condition..
answered Nov 17 '18 at 8:27
suneethsuneeth
484
484
Tried but getting 2 view pages as a result
– dhara
Nov 17 '18 at 8:28
add one more if condition inside if condition for load second view page
– suneeth
Nov 17 '18 at 10:10
Tried but it does not load any data..I get blank page as a result......
– dhara
Nov 17 '18 at 10:13
add a comment |
Tried but getting 2 view pages as a result
– dhara
Nov 17 '18 at 8:28
add one more if condition inside if condition for load second view page
– suneeth
Nov 17 '18 at 10:10
Tried but it does not load any data..I get blank page as a result......
– dhara
Nov 17 '18 at 10:13
Tried but getting 2 view pages as a result
– dhara
Nov 17 '18 at 8:28
Tried but getting 2 view pages as a result
– dhara
Nov 17 '18 at 8:28
add one more if condition inside if condition for load second view page
– suneeth
Nov 17 '18 at 10:10
add one more if condition inside if condition for load second view page
– suneeth
Nov 17 '18 at 10:10
Tried but it does not load any data..I get blank page as a result......
– dhara
Nov 17 '18 at 10:13
Tried but it does not load any data..I get blank page as a result......
– dhara
Nov 17 '18 at 10:13
add a comment |
By using elseif and && operator we can load according to the condition
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);
}
else if(($this->input->post('all')) &&($this->input->post('item')))
{
$this->db->select('vno,Prdtname,Qty,bundle');
$this->db->from('purchaseitem');
$this->db->order_by("vno", "asc");
$this->db->join('itemmaster','itemmaster.itcode = purchaseitem.Product_Code','left outer');
$query = $this->db->get('')->result_array();
$data['query'] = $query;
$this->load->view('Receipt_View1',$data);
}}
else 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);
}
}
add a comment |
By using elseif and && operator we can load according to the condition
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);
}
else if(($this->input->post('all')) &&($this->input->post('item')))
{
$this->db->select('vno,Prdtname,Qty,bundle');
$this->db->from('purchaseitem');
$this->db->order_by("vno", "asc");
$this->db->join('itemmaster','itemmaster.itcode = purchaseitem.Product_Code','left outer');
$query = $this->db->get('')->result_array();
$data['query'] = $query;
$this->load->view('Receipt_View1',$data);
}}
else 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);
}
}
add a comment |
By using elseif and && operator we can load according to the condition
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);
}
else if(($this->input->post('all')) &&($this->input->post('item')))
{
$this->db->select('vno,Prdtname,Qty,bundle');
$this->db->from('purchaseitem');
$this->db->order_by("vno", "asc");
$this->db->join('itemmaster','itemmaster.itcode = purchaseitem.Product_Code','left outer');
$query = $this->db->get('')->result_array();
$data['query'] = $query;
$this->load->view('Receipt_View1',$data);
}}
else 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);
}
}
By using elseif and && operator we can load according to the condition
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);
}
else if(($this->input->post('all')) &&($this->input->post('item')))
{
$this->db->select('vno,Prdtname,Qty,bundle');
$this->db->from('purchaseitem');
$this->db->order_by("vno", "asc");
$this->db->join('itemmaster','itemmaster.itcode = purchaseitem.Product_Code','left outer');
$query = $this->db->get('')->result_array();
$data['query'] = $query;
$this->load->view('Receipt_View1',$data);
}}
else 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);
}
}
answered Nov 21 '18 at 10:38
dharadhara
20314
20314
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53349242%2fhow-to-load-the-view-page-according-to-the-condition%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown