Novanda
Novanda

Reputation: 29

Detail Page using CodeIgniter

I want to create a detail page, but when I click button examp_title, I can't move to Tryout/soal.

Thank You

Controller (Tryout.php)

public function deskripsi($tryout_id)
{
    $data['tryout'] = $this->M_tryout->deskripsi_to($tryout_id)->row();
    $data['exam_tpa'] = $this->M_tryout->get_exam_tpa($tryout_id)->result();
    $data['exam_tps'] = $this->M_tryout->get_exam_tps($tryout_id)->result();
    $this->load->view('tryout/deskripsi', $data);
}


public function soal($exam_code)
{
    $data['soal'] = $this->M_tryout->get_soal_tryout($exam_code)->result;
    $this->load->view('tryout/soal', $data);
}

View (deskripsi.php)

<?php foreach ($exam_tps as $key => $value) { ?>

     <h5 class="fw-bold" class="sub_to">
         <a href="<?php base_url('tryout/soal/') ?> 
             <?php echo $exam->exam_code?>">
             <?php echo $value->exam_title;?>
         </a>
     </h5>
            
     <p>
         <?php echo $value->exam_duration;?> Menit, 
         <?php echo $value->exam_count_question;?> soal <br> Pembahasan
     </p>
<?php } ?>

Upvotes: 0

Views: 163

Answers (1)

SH_
SH_

Reputation: 266

It looks like your <a> tag is not outputting the link you want due to a missing echo.
I have simplified the href below...

<h5 class="fw-bold" class="sub_to">
    <a href="<?php echo base_url('tryout/soal/') . $exam->exam_code ?>">
        <?php echo $value->exam_title; ?>
    </a>
</h5>

Upvotes: 1

Related Questions