I have inserted this form with multiple checkbox items which collects some values, What i need to do is echo this values as a string separated by a comma, but i’m getting error in the implode function, it says Invalid arguments passed.
Can you please see the code?
if(isset($_POST['Submit'])) {
echo "<pre>"; print_r($_POST);
$checked = mysql_real_escape_string(implode(',', $_POST['checkbox']));
echo $checked;
}
?>
HTML Form
<form action="checkbox.php" method="post">
<input type="checkbox" name="checkbox[]" value="hostess_name">
<input type="checkbox" name="checkbox[]" value="hostess_familyname_en">
<input type="checkbox" name="checkbox[]" value="hostess_id">
<input type="checkbox" name="checkbox[]" value="hostess_firstname_en">
<br>
<br>
<input type="submit" name="Submit" value="Submit">
</form>
try this
here’s the exact stuff I put in my
test.php