I have an online exam system which is able to generate a pdf certificate once a click on the view download button. However, I would like the system to automatically generate a pdf certificate once a user clicks on the Finish button. Please help.
My part of my exam controller
if ($this->input->post('Finish') == 'Finish') {
foreach ($this->input->post() as $key=>$value) {
$useroptions[$key] = $value;
if ($key != 'Finish') {
if (intval($value) == 0) {
$not_attempted++;
}
if($answers[$key] == intval($value)){
$score++;
}
}
}
The view for the download button is
<div class="col-md-4">
<a href="<?php echo base_url();?>user/certificate/<?php echo $h->quiz_id;?>" target="_blank">
<div class="btn bg-primary exam-histry-btn">Download Certificate </div>
</a>