私は2つのタブを持つフォームを持っています.この2つのタブには結果を得るために2つの選択肢があります.単一のフォーム そして、これは私のビューファイルです
<ul id="myTab2" class="nav nav-tabs sidebar-tabs">
<li class="active">
<a href="#myTab2_example1" data-toggle="tab">
All Merchant IDs
</a>
</li>
<li>
<a href="#myTab2_example2" data-toggle="tab">
Single Merchant ID
</a>
</li>
<li>
<div class="tab-content">
<div class="tab-pane fade in active" id="myTab2_example1">
<div class="search_block">
<div class="form-group mar-b0">
<div class="section colm colm4">
<label class="tp-label">Select a year</label>
<select name="transactionYear" id="transactionYear" aria-required="true" required="required">
<?php $year=$this->livemerchant_model->Year_dropdown();
foreach ($year as $row){
?>
<option value="<?php echo $row->TheYear ?>"><?php echo $row->TheYear ?> </option>
<?php }?>
</select>
<input type="submit" name="reqsub" id="reqsub" class="btn btn-primary">
</div>
</div>
</div>
<div class="row">
<div class="col-lg-4 col-sm-12">
<table class="table table-bordered">
<thead>
<tr>
<th>Month</th>
<th>GBP</th>
</tr>
</thead>
<tbody>
<?php
foreach ($monthlyTotals as $row) {?>
<tr>
<td><?php echo $row->TheMonthName . PHP_EOL; ?></td>
<td><?php echo $row->TotalAmount. PHP_EOL;?></td>
</tr>
<?php }?>
</tbody>
<tfoot>
</tfoot>
</table>
</div>
<?php //echo form_open_multipart(base_url().'index.php/AdminController/sample');?>
<div class="search_block">
<div class="form-group mar-b0">
<div class="section colm colm4">
<label class="tp-label">Merchant ID</label>
<select name="transactionMerchant" id="transactionMerchant" aria- required="true" required="required">
<?php $merchanttype = $this->livemerchant_model- >merchant_type_dropdown();
foreach ($merchanttype as $merchant){
?>
<option value="<?php echo $merchant->TRANS_MerchantId ?>"><?php echo $merchant->TRANS_MerchantId ?></option>
<?php }?>
</select>
<select name="transactionYear" id="transactionYear" aria-required="true" required="required">
<?php $year=$this->livemerchant_model->Year_dropdown();
foreach ($year as $row){
?>
<option value="<?php echo $row->TheYear ?>"><?php echo $row->TheYear ?></option>
<?php }?>
</select>
<input type="submit" name="tell" id="tell" >
</div>
<?php echo form_close();?>
</div>
</div>
<div class="row">
<div class="col-lg-4 col-sm-12">
<table class="table table-bordered">
<thead> <tr>
<th>Month</th>
<th>GBP</th> </tr>
</thead>
<tbody>
<?php foreach ($monthlyTotals as $row) {?>
<tr>
<td><?php echo $row->TheMonthName . PHP_EOL; ?>
<td><?php echo $row->TotalAmount. PHP_EOL;?></td>
</tr>
<?php }?>
</tbody>
<tfoot>
</tfoot>
</table>
</div>
そして、これは私のコントローラーです
public function overviews()
{
$data['monthlyTotals'] = $this->livemerchant_model->overviews();
if ($this->input->post('transactionMerchant,transactionYear')) {
$data['monthlyTotals'] = $this->livemerchant_model->overviews($this->input->post('transactionMerchant'), $this->input->post('transactionYear'));
} else {
$data['monthlyTotals'] = $this->livemerchant_model->overviews();
}
$this->load->view('overviews', $data);
}
タブの問題を解決するのを手伝ってくれる人はいますか