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 928641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:02:36+00:00 2026-05-15T20:02:36+00:00

I am trying to implode an array in a $_POST[]. I am doing this

  • 0

I am trying to implode an array in a $_POST[]. I am doing this inside of a loop which searches for values in ~31 arrays…$_POST[‘1’], $_POST[‘2’], $_POST[‘3’], etc.

I am trying to do this with:

while($i <= $_SESSION['daysInMonth']){

$month = $_SESSION['month'];
$day = $i;
$names = implode(',',$_POST['names_'.$i]);
$region = $_SESSION['region'];
$date = date("Y").'-'.$month.'-'.$day;

echo("$names");

$i++;

}

I am receiving the following error, though:

Warning: implode() [function.implode]: Invalid arguments passed in /home/content/r/e/s/reslife4/html/duty/schedule.php on line 15

This is how I create the $_POST[] variables:

<?php $i=1; while($i <= $daysInMonth){?>
            <table align="center" style="width: 435px">
                <tr>
                    <td class="style1"><p><select name="names_<?php echo($i); ?>[]" multiple="multiple">
                    <?php foreach($email_array as $arr){ ?>
                        <option><?php echo($arr); ?></option>
                    <?php } ?>
                    </select></p></td>
                </tr>
            </table>
<?php $i++; }?>

Can anyone see what I am doing wrong?

Thanks!

  • 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-05-15T20:02:37+00:00Added an answer on May 15, 2026 at 8:02 pm

    If you pass something other than an array as the second argument to implode (say, when no options were selected), you will receive the warning. You can either conditionally implode:

    if (!empty($_POST['names_'.$i])) 
    // implode
    

    or cast to array:

    $names = implode(',', (array)$_POST['names_'.$i]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implode an array of both its keys and values. I can
I have a variable holding values separated by a comma (Implode), and I'm trying
I am trying to build a query from the values of an array so
I'm trying to insert array into database. Why don't this work? $array_zone = array();
I'm trying to count all the values in the array and check if one
I am trying to the implode the userIDs in the $users_in_range array the problem
Trying to setup Zend Framework as instructed in this manual $paths = array( realpath(dirname(__FILE__)
I'm trying to create a calculation based on the values of the array -
Hi guys I am trying to post values which is getting number from another
I'm trying to retrieve options/values from my database in the from of an array

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.