So basically I'm not an expert in this and I cant find any solution, so what I wanted to do is adding a submitted date into global variable.
User will have to input the selected date range, and when User click the "submit" button, the data will appear.
<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>
and here's my controller if anyone needs it.
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);
}
How can I create a variable for the "date" to be global, so I can use that date variable in multiple function in controller? Thanks