Codeigniter get post data : $this->input->post(‘field_name’); is used for getting data from post method.
Syntax : Codeigniter get post data
$this->input->post('field_name');
Suppose we have a simple form :
echo form_open('Mycontroller/saveme', array('method'=>'post')); ?> echo form_input('name'); ?> echo form_submit('submit','Submit Me'); ?> echo form_close(); ?>
Suppose our controller is :
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Mycontroller extends CI_Controller { public function saveme(){ echo $this-?>input->post('name'); } }
which will print the name posted from the form using post method