php - Array not repeating inside in for loop -
i have array autofilled multi select form. have display values initial values, , have array it. code.
for($i=0; $i<count($temp_multy_name); $i++) { echo $temp_multy_name[$i]; echo" "; $pac->set_init_selection(array( array("id"=>"$temp_multy_name[$i]", "text"=>"$temp_multy_name[$i]"), )); }
when run echo $temp_multy_name[$i]
, php , mysql, when apply in set_init_selection
got lastly value, don't know why. can 1 please help me?
here solution
$setinitselection = array(); for($i=0; $i<count($temp_multy_name); $i++) { echo $temp_multy_name[$i]; echo" "; $setinitselection[] = array("id"=>$temp_multy_name[$i], "text"=>$temp_multy_name[$i]); } $pac->set_init_selection($setinitselection);
php mysql arrays for-loop
No comments:
Post a Comment