I’m getting an error Warning: implode() [function.implode]: Invalid arguments passed in /home/social/public_html/form_test.php on line 13 I’m not sure why i’m getting this error.
if (is_array($_POST['wmeet']))
foreach ($_POST['wmeet'] as $key => $value)
$_POST['wmeet'][$key] = mysql_real_escape_string(stripslashes($value));
$wmeet = implode(" ",$_POST['wmeet']);
echo '<pre>'; print_r($wmeet); echo '</pre>';
You are not using braces. When you check
is_array, theifstatement only applies to the following line (thefor each). Thefor eachis only being applied to the following line as well, then theifblock ends.This means that when you use
implode(), it is outside of theifblock, and therefore not ensuring that your argument is an array. You should look at Alex’s answer and adjust your code accordingly, so that theimplode()line is within theifblock.Your code right now is functioning like this:
When it should be like this: