I have a code that to generate a PDF it checks what is marked in the checkbox. But if I do not mark anything, it still opens the PDF, only with the blank sheet. You can do a if
that if nothing has been marked, display an alert on the screen for the user. My code is written in Codeigniter, and the view of the report has the following code:
if (in_array("foto", $itens)) {
//código para mostrar a foto se está marcada a opção no checkbox
}
My controller is:
$itens = $this->input->post('itens');
if (!empty($itens)) {
$data['itens'] = $itens;
} else {
$data['itens'] = array(null);
}
$this->load->view('ViewDoRelatorio', $data);