Get post values when the key is unknown in CodeIgniter


CodeIgniter allows access to POSTed data via:


where 'input_name' is the name of a form field. This works well for a static form where each input name in known ahead of time.

In my case, I am loading a collection of key/value pairs from the database. The form contains a text input for each key/value pair.

I am wondering, is there a way to get an array of posted data via the CodeIgniter api?


11/18/2008 7:29:19 PM

Accepted Answer

According to the documentation, no. I would suggest just using array_keys($_POST) to get the keys.

11/18/2008 7:35:46 PM

foreach($this->input->post() as $key => $val)  {  echo "<p>Key: ".$key. " Value:" . $val . "</p>\n";  } 

that can be used to

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow