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.
First of all there are few mistakes in your code.
Solution :
1. You can assign value as comma separated
like “x,y,z”