better way of getting get/post vars then _GET and _POST |
[eluser]pocketmax[/eluser]
is there a better way of getting GET and POST vars then using the standard $_GET and $_POST? or is that the only way to get POST/GET vars in CI?
[eluser]WebsiteDuck[/eluser]
$this->input->get('variable'); $this->input->post('variable'); http://ellislab.com/codeigniter/user-gui...input.html
[eluser]pocketmax[/eluser]
Is there a way I can get a quick assoc array of the get or post vars? I tried $this->input->get() thinking it would automagicly give me the assoc but no such luck.
[eluser]Dyllon[/eluser]
[quote author="pocketmax" date="1263271571"]Is there a way I can get a quick assoc array of the get or post vars? I tried $this->input->get() thinking it would automagicly give me the assoc but no such luck.[/quote] The get() and post() functions of the input class will fetch only one value at a time, if you need the assoc array then use $_GET or $_POST
[eluser]Colin Williams[/eluser]
It's a bit of a bizarre question that pops up here from time to time. It's akin to saying, I have this array: Code: $foo = array('name' => 'Sam', 'id' => '342'); Does CI provide a way to get $foo as an associative array? (Note, if it's security you are worried about, you can xss_clean() the array before using it) Code: $values = xss_clean($_POST);
[eluser]Dyllon[/eluser]
In addition to what Colin said if you have global xss filtering on the input class is nice enough to automagically clean the $_POST array for you. |
Welcome Guest, Not a member yet? Register Sign In |