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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:01:24+00:00 2026-05-26T08:01:24+00:00

I am trying to submit this multi select as an array but when I

  • 0

I am trying to submit this multi select as an array but when I submit it nothing prints to the screen so what am I doing wrong?

HTML

  <div class="container">  
    <select name="itemsToChoose" id="left" size="8" multiple="multiple">      
      <option value="1">item1</option>  
      <option value="2">item2</option>  
      <option value="3">item3</option>  
      <option value="4">item4</option>  
      <option value="5">item5</option>  
    </select>  
  </div>  

  <div class="low container">  
    <input name="left2right" value="add" type="button">  
    <input name="right2left" value="remove" type="button">  
  </div>  


  <form  Method ="POST" action="multiSelectRead.php">


  <div class="container">  
    <select name="itemsToAdd" id="right" size="8" multiple="multiple">  
    </select>  
  </div>  

  <input type="submit" style="width: 75px; border: 1px solid gray" value="Submit">
<br />

         </form>

The JS code:

$(function() {
    $(".low input[type='button']").click(function() {
        var arr = $(this).attr("name").split("2");
        var from = arr[0];
        var to = arr[1];
        $("#" + from + " option:selected").each(function() {
            $("#" + to).append($(this).clone());
            $(this).remove();
        });
    });
})



$('form').submit(function() {
    $('#seldist option').each(function(i) {
        $(this).attr("selected", "selected");
    });
});

multiSelectRead.php

<?php

print_r($_POST["itemsToAdd"]);



?>

The user is suppose to add values then hit submit. But I tried it and yet it wont pass the itemstoAdd values in array to php….

Here is snippet: http://jsfiddle.net/an4gA/

  • 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-26T08:01:25+00:00Added an answer on May 26, 2026 at 8:01 am

    In the jsFiddle you posted, your jQuery code to select the options reads:

    $('#seldist option').each(function(i) {
        $(this).attr("selected", "selected");
    });
    

    Thing is, your select box’s ID is “right”.

    Either change the #seldist above to #right, or change your select box’s ID to “seldist”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to submit when a dropdownlist changes by doing this @using (Html.BeginForm(testAction,
Am new to this and just trying to submit dynamically populated select list on
I am trying to understand the difference between this: if (isset($_POST['Submit'])) { //do something
Im trying to submit a specific form programatically, but I allways get the initial
I've been trying to submit a form with the FormPanel using the Action class
I'm trying to submit a form with javascript. Firefox works fine but IE complains
Well I am trying to submit a form by pressing enter but not displaying
I'm trying to submit a form on an .asp page but Mechanize does not
i get this error when trying to submit the order in the shopping cart
I am trying to submit this with Ajax to a MVC3 controller: var params

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.