'Why Post request not working on server with codeigniter 4?

I started using codeigniter 4. Everything working properly on localhost but after installing on a host only "post" request not working. I cant get any value after post request.

HTML:

<form  action="<?php echo base_url()."/slider/ekle" ?>" method="POST" enctype="multipart/form-data" >

        <div class="form-group">
          <label>Başlık</label>
          <input type="text" class="form-control"  placeholder="Slider başlığı" name="baslik" value=""/>
  
       </div>

      <div class="form-group mb-0">
         <div>
            <button type="submit" class="btn btn-primary waves-effect waves-light mr-1">Ekle</button>
         </div>
      </div>
</form>

Ekle.php (Controller )

public function ekle()
{
    $baslik=$this->request->getPost("baslik");
    $aciklama=$this->request->getPost("aciklama");
    print_r($baslik);
    die();
}

What I mean is every code is working well on "localhost" but "post" request not working on my remote hosting.



Solution 1:[1]

use $this->request->getVar() instead of $this->request->getPost()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ali Sheykhi