This is my php code:
$allids_arr = $_REQUEST['allids'];
print_r($allids_arr);
echo $arr_count = count($allids_arr);
The array printed like this:
Array (
[0] => 26
[1] => 27
[2] => 28
[3] => 29
[4] => 30
[5] => 31
[6] => 32
[7] => 33
)
But the count display as 1.
But the correct answer is 8.
What is the problem in my code?
EDIT:
The array was i created: This is the code for my array creation:
$allids = array();
$ikall = 0;
foreach($alldata as $rwosall){
$allids[$ikall] = $rwosall['journelmodel']['id'];
$ikall++;
}
$this->set('alldataids', $allids);
This is in my controller.And in my view page:
<input type="hidden" readonly="" id="allids" class="input1" name="allids" value="<?php print_r($alldataids);?>">
This value was i requested when form submitted.
1...echo count($_REQUEST['allids']);at the top of your script. Then put$allids_arr = $_REQUEST['allids'];right afterwards. Then putecho count($allids_arr);right after that. No reason that should not give you consistent output. Also pleaseprint_r($_REQUEST)to make sure you are doing that right.<input..>field to do with output fromprint_r($array). That doesn't look like it'll work.