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

  • Home
  • SEARCH
  • 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 8863549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:00:26+00:00 2026-06-14T16:00:26+00:00

I am using Jquery Multiselect Widget to have a dropdown list box with mulitselect

  • 0

I am using Jquery Multiselect Widget to have a dropdown list box with mulitselect option. I am populating the dropdown with the data from MySql database. I was not able to pass multiple values to the php file in $_POST.

My HTML & PHP code for Multiselect DropDown.

   <form id="intermediate" name="inputMachine" method="post">

<select id="selectDuration" name="selectDuration" multiple="multiple"> 
  <option value="1 WEEK" >Last 1 Week</option>
  <option value="2 WEEK" >Last 2 Week </option>
  <option value="3 WEEK" >Last 3 Week</option>
</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


    <?php
        //include '../db/interface/DB_Manager.php';
        $connect = mysql_connect("localhost", "root", "infinit") or die(mysql_error()); 
        mysql_select_db("serverapp") or die(mysql_error()); 

        $query = "select id,name from rpt_shift_def"; //Write a query
        $data = mysql_query($query);  //Execute the query
    ?>
    <select id="selectShift" name="selectShift" multiple="multiple">
    <?php
    while($fetch_options = mysql_fetch_array($data)) { //Loop all the options retrieved from the query
    ?>

    <option name="selected_ids[]" id ="<?php echo $fetch_options['id']; ?>"  value="<?php echo $fetch_options['name']; ?>"><?php echo $fetch_options['name']; ?></option><!--Echo out options-->
    <?php
        }
    ?>
    </select>

Here i’m populating Shift dropdown in Multiselect Dropdown. If i select more than one shift, i was not able to get all those selected values in php. instead i get only the last selected value.

i want to do something like this.

   $shiftarraycalc = array();

foreach ($_POST['selectShift'] as $key => $value) {
    array_push($shiftarraycalc,$value);
}

but its not working.

I have no idea how to get multiple values in $_POST.

  • 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-14T16:00:27+00:00Added an answer on June 14, 2026 at 4:00 pm

    Modified name as array in select

    <select id="selectShift" name="selectShift[]" multiple="multiple">
    

    and did like this and it works

    $shiftarraycalc = array();
    $shift=$_POST['selectShift'];
    
    if ($shift)
    {
        foreach ($shift as $value)
        {
            array_push($shiftarraycalc,$value);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using a jquery multiselect plugin http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/ with option. All works fine, however
I am using jquery grid version 4.4.1 . I have used multiselect: true option
I'm using Eric Hynds jquery API for jQuery UI MultiSelect-dropdown Widget I'm having one
I'm using Datatables and have this jquery plugin showing in a few columns http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/
So the situation is this: I'm creating a dropdown box using the jquery.multiselect plugin
So the situation is this: attempting to add a dropdown box using the jquery.multiselect
I am using jquery multiselect plugin, If an option has been selected i would
I am using Eric Hynds’ jQuery for a multi-select list. I have created the
I'm using the jquery multiselect control from: http://abeautifulsite.net/notebook/62 I need to manually check one
Using jQuery Multiselect plugin and need to check if any selections have been made

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.