I am implementing the functionality for an admin to generate .csv files with all the data from the table Events in a certain period of time.
The problem is I’m still getting these errors:
Warning (2): rawurlencode() expects parameter 1 to be string, array given [CORE\src\Routing\Route\Route.php, line 574] Warning (2): rawurlencode() expects parameter 1 to be string, array given [CORE\src\Routing\Route\Route.php, line 574]
I am suspecting that this is the problem with my redirect line.
exportcsv
method in EventsController
public function exportcsv($beginning = null, $end = null)
{
if ($this->request->is('post')) {
$beginning = $this->request->data['Export']['beginning'];
$end = $this->request->data['Export']['end'];
return $this->redirect([$beginning, $end]); //I think that this line causes trouble
}
if (!$beginning && !$end) {
return $this->render();
}
/* existing export action code *\
}
exportcsv.ctp
view:
<div class="events form large-6 medium-4 columns content">
<?= $this->Form->create('Export'); ?>
<?= $this->Form->input('beginning', array('type'=>'datetime', 'interval' => 15, 'label' => 'Beginning:')); ?>
<?= $this->Form->input('end', array('type'=>'datetime', 'interval' => 15, 'label' => 'End:')); ?>
<?= $this->Form->button(__('Add')) ?>
<?= $this->Form->end() ?>
</div>
I am new to CakePHP and I think that there is some minor error in my code that causes it. Can you help me fix the problem?