0
所以基本上我不是這方面的專家,也找不到任何解決方案,所以我想要做的是將提交的日期添加到全局變量中。從表單行爲到控制器中的全局變量
用戶將不得不輸入選定的日期範圍,當用戶單擊「提交」按鈕時,數據將出現。
<form method="post" action="<?php echo base_url() ?>index.php/overview/overall" class="form-inline">
<div class="input-group-addon">Please Choose the Date</div>
<input name="date-selector" type="text" class="form-control daterange" id="inlineFormInputGroup" placeholder="">
<input type="submit" name="submit" value="Submit" class="btn btn-primary">
</form>
這裏是我的控制器,如果有人需要它。
public function overall(){
$date = $this->input->post('date-selector');
$start_date = date("Y-m-d", strtotime(substr($date, 0,10)));
$end_date = date("Y-m-d", strtotime(substr($date, 13,22)));
$data = $this->overview_model->overall_data($start_date,$end_date);
}
如何創建一個變量爲「日期」是全球性的,所以我可以在控制器中的多個函數中使用該日期變量?謝謝
請按照以下鏈接尋求幫助: http://stackoverflow.com/questions/17013397/code-igniter-best-place-to-declare-global-variable –
@RanvirSingh事情是,用戶我想用戶要插入日期,我該如何配置? – xharmas