Hello, how you doing?, For you to be here , that means you have a basic knowledge on how codeigniter 4 works or you just wanna try it out.
So in this case we will be looking at how to send POST request from view to controller and back to the view, Lets dive in.
Step 1. Set up a new codeigniter 4 project, Docs : Codeigniter
Step 2. Create a controller and pass in this.
public function post(){
if($this->request->getMethod() == 'post'){
echo "Hello world";
}
}
Step 3. in your view create a form and add a button.
Like this
<form action="" method="post">
<button>Click me </button>
</form>
Thats all, its not something more complex or buggy.. its just simple..
Please subscribe to my channel DevStack
Top comments (0)