Codeigniter – How to get form post data in controller?

Codeigniter – How to get form post data in controller?

In this post we will give you information about Codeigniter – How to get form post data in controller?. Hear we will give you detail about Codeigniter – How to get form post data in controller?And how to use it also give you demo for it if it is necessary.

Here, i will give you simple two way to get form post data in codeigniter 3 project. you can simply get all post data using $this->input->post() and $_POST using simple php stuff.

when i was working on my codeigniter 3 application and i try to get post data using $this->input->post() then i can’t get value. i don’t know it was not working, but i try to run with virtual domain and with localhost then it was working fine. So if you are trouble with getting form post data then it will help you.

Controller Method:

public function formPost()

{

print_r($this->input->post('name'));

print_r($this->input->post('email'));

print_r($this->input->post());

print_r($_POST['name']);

print_r($_POST['email']);

print_r($_POST);

exit;

}

HTML Form:

Also see:Codeigniter 3 create zip file and download example

<form action="/formPost" method="POST" enctype="multipart/form-data">

<div >

<label for="exampleInputEmail1">Email address</label>

<input type="email" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email" name="email">

</div>

<div >

<label for="exampleInputEmail1">Name</label>

<input type="text" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter Name" name="name">

</div>

<button >Save</button>

</form>

I hope it can help you…

Hope this code and post will helped you for implement Codeigniter – How to get form post data in controller?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

85  +    =  87

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US