• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Documentation improvements

#2
In the section explaining $this->input->post(), it would be helpful if the documentation noted that array elements cannot be retrieved individually.

This comes up when you use an array in your forms. If you use $book['isbn'], $book['author'], $book['title'], $book['price'] in your form, for example, upon posting the form, the $_POST array will contain an array called book with keys isbn, author, title, and price. You can retrieve those one by one directly by accessing the $_POST variable, like this:
PHP Code:
$price $_POST['book']['price']; 

But using the Post method of the Input class, you must get the whole array and then access the individual elements, like this:
PHP Code:
$book $this->input->post('book');
$price $book['price']; 
Reply


Messages In This Thread
Documentation improvements - by RobertSF - 11-09-2014, 05:45 PM
RE: Documentation improvements - by RobertSF - 11-11-2014, 11:54 AM
RE: Documentation improvements - by Chroma - 11-14-2014, 09:30 AM
RE: Documentation improvements - by Narf - 11-17-2014, 04:41 AM
RE: Documentation improvements - by RobertSF - 11-17-2014, 03:21 PM
RE: Documentation improvements - by Narf - 11-18-2014, 02:36 AM
RE: Documentation improvements - by includebeer - 11-17-2014, 07:01 PM
RE: Documentation improvements - by RobertSF - 11-17-2014, 07:03 PM
RE: Documentation improvements - by includebeer - 11-17-2014, 08:28 PM
RE: Documentation improvements - by twpmarketing - 11-18-2014, 03:13 PM
RE: Documentation improvements - by slax0r - 11-18-2014, 01:11 AM
RE: Documentation improvements - by sv3tli0 - 11-18-2014, 03:20 AM
RE: Documentation improvements - by jlp - 12-31-2014, 04:28 PM
RE: Documentation improvements - by RobertSF - 12-31-2014, 05:25 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.