0

An array I use in my PHP code can grow only up to 7 elements. Could anybody shed some light to figure this out? please.

Description: I use a PHP session to store an array, which should grow by adding data element on each click I made using Ajax call. (using PHP 5, codeIgniter 2.0.3)

Code:

$companyAddressList = $this->session->userdata('companyAddressList');

$companyAddressList[] = $_POST['address'];
$this->session->set_userdata('companyAddressList',$companyAddressList);

Above code add data (an array containing address details) to the "companyAddressList" array for upto 7 elements, but after that the last array element get replaced with each new address data.

hakre
  • 193,403
  • 52
  • 435
  • 836
Lak Ranasinghe
  • 240
  • 4
  • 13
  • I think that your problem is elsewhere in your code, i tryied this and works fine with me, the problem may also lie in your form data – Decebal Sep 20 '11 at 07:45
  • Thanks @decebal for the response. Yes, I left it as it is yesterday as I already spent good 3 hours trying to figure the problem. Tonight I'll have a look at it again. Hopefully I'll find the reason for it. Thanks again. – Lak Ranasinghe Sep 21 '11 at 04:42
  • Session data in Codeigniter is size-limited. Always consult the manual and be sure to read all notes before using a feature. – hakre Dec 15 '12 at 21:22

0 Answers0