Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8105113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:04:53+00:00 2026-06-06T00:04:53+00:00

I have inserted this form with multiple checkbox items which collects some values, What

  • 0

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>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:04:54+00:00Added an answer on June 6, 2026 at 12:04 am

    try this

    if(isset($_POST['Submit'])) {
        echo "<pre>"; print_r($_POST);
        $checked = implode(',', $_POST['checkbox']); 
        echo $checked;
    }
    

    here’s the exact stuff I put in my test.php

    <?php
    if(isset($_POST['Submit'])) {
        echo "<pre>";
        $checked = implode(',', $_POST['checkbox']);
        echo $checked;
    }
    
    ?>
    <form action="test.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>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my form, there are values to be inserted to multiple tables. After inserting
I have been able to retrieve values into my form.The values are inserted into
I have a popup <div> which clones a hidden form and inserts this into
I have this form which has a section where a user can specify an
I have a form which contains some unique input fields and some others with
I have inserted the following line into my Joomla template: <jdoc:include type=component /> This
I have inserted a code to display product attribute in view.phptml, which works fine.
I have a DropDownList as a custom control inserted into a subform which is
I have inserted a hidden input in my comment form: $ip = $_SERVER['REMOTE_ADDR']; <input
I read this question , which highlights a solution to conditionally insert values into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.