Atakan Acar
Atakan Acar

Reputation: 33

Fatal error: Uncaught ArgumentCountError

I get this error. I created a button to update the table. When I click the button, I get an error. How to fix it?

Fatal error: Uncaught ArgumentCountError: Too few arguments to function personel::update_form(), 0 passed in C:\xampp\htdocs\warehouse\panel\system\core\CodeIgniter.php on line 360 and exactly 1 expected in C:\xampp\htdocs\warehouse\panel\application\controllers\personel.php:57 Stack trace: #0 C:\xampp\htdocs\warehouse\panel\system\core\CodeIgniter.php(360): personel->update_form() #1 C:\xampp\htdocs\warehouse\panel\index.php(202): require_once('C:\xampp\htdocs...') #2 {main} thrown in C:\xampp\htdocs\warehouse\panel\application\controllers\personel.php on line 57

Fİle Name: personel.php Controller

MY CODES

 public function update_form($id){

        $where = array( "id" => $id);

        $personel = $this->Personel_model->get($where);

        $viewData["personel"] = $personel;


        $this->load->view("personel_edit");

     }

MY BUTTON CODES

 <a href="<?php echo base_url("personel/update_form"); ?>" class="btn-sm btn-warning">Update </a>

Upvotes: 2

Views: 8621

Answers (1)

AbdulAhmad Matin
AbdulAhmad Matin

Reputation: 1146

You must pass an ID with the button to function in the controller like this.

 <a href="<?php echo base_url("personel/update_form/".$row->id); ?>" class="btn-sm btn-warning">Update </a>

Upvotes: 1

Related Questions