$participant_array = array();
$find_all_locations = mysql_query("SELECT location_id FROM locations");
while($fetch_all_locations = mysql_fetch_array($find_all_locations)) {
$location_id_found = $fetch_all_locations['location_id'];
// Generate the array key name for the POST variable
$postkey = "participants_".$location_id_found;
// Count the amount of array items
$countamount = count($_POST[$postkey]);
// Remove empty keys
for($counter = 0;$counter <= $countamount;$counter++) {
if($_POST[$postkey][$counter] == "" OR $_POST[$postkey][$counter] == NULL) {
unset($_POST[$postkey][$counter]);
}
}
$participant_array[$location_id_found] = implode(",", $_POST[$postkey]);
}
When I change $_POST[$postkey] to one of the actual names ($_POST['participants_1']), it does not show an error. I have verified that $_POST[$postkey] is an actual array. Altough it shows these errors, it does work though. So it's complaining about an issue that doesn't exist. Is this a bug, or am I doing something wrong?
No replies to this topic
#1
Posted 13 October 2011 - 10:46 AM
I'm having an issue with the implode() function in PHP. Basically I have a dynamicly built form which uses POST with array-names to pass information. Therefore some of the $_POST array items contain another batch of arrays.
|
|
|
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









