按下提交按钮后,组合框返回默认值

时间:2016-05-25 16:33:39

标签: html select filter combobox dropdown

你好,我想问一下..

我有组合框的问题, 这是我的代码:

<?php $abc =  date("Y"); ?>
                <form action="dashboard" method="get">
                <select name="tahun" style="padding:3px;margin-right:20px">
                <option value="semua">   Pilih Tahun   </option>                    
                <?php 
                for ($x = 2014; $x <= $abc; $x++) {
                echo "<option value=$x>$x</option>";
                } 
                ?>                      
                </select>

                <select name="bulan" style="padding:3px;margin-right:20px">
                <option value="semua">Pilih Bulan</option>  
                <?php 
                for ($y = 1; $y <= 12; $y++) {
                echo "<option value=$y>$y</option>";
                } 
                ?>    
                </select>  
                <input type="submit" class="btn btn-info" style="border-color:red; background-color:red">
                </form> 

这是代码dashboard.php先生(编辑):

public function dashboard()
{       
    $tahun = 'semua';
    $bulan = 'semua';

    if (isset($_GET["tahun"]))
    {
        $tahun = $_GET["tahun"];
    }
    if (isset($_GET["bulan"])) 
    {
        $bulan = $_GET["bulan"];
    }

    $data['all_cust'] = $this->bidashboard_model->all_cust($tahun, $bulan);
    $data['all_request'] = $this->bidashboard_model->all_request($tahun, $bulan);
    $data['piegraphkota_cust']=$this->bidashboard_model->piegraphkota_cust($tahun, $bulan);
    $data['piegraphkec_cust']=$this->bidashboard_model->piegraphkec_cust($tahun, $bulan);
    $data['piegraphkel_cust']=$this->bidashboard_model->piegraphkel_cust($tahun, $bulan);
    $data['piegraphkota_req']=$this->bidashboard_model->piegraphkota_req($tahun, $bulan);
    $data['piegraphkec_req']=$this->bidashboard_model->piegraphkec_req($tahun, $bulan);
    $data['piegraphkel_req']=$this->bidashboard_model->piegraphkel_req($tahun, $bulan);
    $data['count_cust']=$this->bidashboard_model->count_cust($tahun, $bulan);
    $data['count_custseb']=$this->bidashboard_model->count_custseb($tahun, $bulan);
    $data['count_req']=$this->bidashboard_model->count_req($tahun, $bulan);
    $data['count_reqseb']=$this->bidashboard_model->count_reqseb($tahun, $bulan);
    $data['jmlcustbaru']=$this->bidashboard_model->jmlcustbaru($tahun);
    $data['jmlreqbaru']=$this->bidashboard_model->jmlreqbaru($tahun);       
    $data['top5cust']=$this->bidashboard_model->top5cust($tahun, $bulan);

    $this->mylibrary->views('view_dashboard',$data);
}

示例: 在我选择tahun = 2016之后,bulan = 1并按下按钮将所选项目提交回&#34; pilih tahun&#34;和&#34; pilih bulan&#34;再次,但数据仍然处理。

如何在视图中选择所选项目(2016,1)。 对不起,如果我的问题不清楚,我的英语不好。

的问候,

ridho

0 个答案:

没有答案