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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:59:46+00:00 2026-06-07T11:59:46+00:00

I have this jQuery code to add <select> elements in a table row with

  • 0

I have this jQuery code to add<select> elements in a table row with an “add” button:

$("#add").click(function() {
    $('#selected > tbody:last').append('<tr><td><select id=\'plan_id\'><option value=\'1\'>One</option><option value=\'2\'>Two</option><option value=\'3\'>Three</option></select></td></tr>');
    });

What do I need to modify in the below code to be able to POST multiple values from the select elements as an array? Right now it only inserts one value at the time to my MySQL database.

$('#course_update').click(function() {

var course_id = $('#course_id').val();
var plan_id = $('#plan_id').val();
var price_id = $('#price_id').val();
var course_name = $('#course_name').val();
var course_isActive = $('#course_isActive').val();
var course_city_id = $('#course_city_id').val();


$('#update_status').html('<img src="../images/ajax-loader.gif" />');
$.post('../update.php', {

    course_id: course_id, 
    plan_id : plan_id,
    price_id: price_id,
    course_name: course_name,
    course_city_id: course_city_id,
    course_isActive: course_isActive

    }, function(data) {
    $('#update_status').html(data);
    return false;
 });
});
  • 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-07T11:59:47+00:00Added an answer on June 7, 2026 at 11:59 am

    First of all you have to use classes for your selects instead of an id. jQuery will only return one element when you use an id. After that the following function will convert all values of the selects you give as paramater as an array.

    /**
     * Convert select to array with values
     */    
    function serealizeSelects (select)
    {
        var array = [];
        select.each(function(){ array.push($(this).val()) });
        return array;
    }
    

    So:

    var course_ids = serealizeSelects($('.course_id'));
    

    Should for example return:

    [1,3,2]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this jquery code $(#eioShowLink).on('click',function(){ $(#ioEditRelatedConcepts).html(''); $.getJSON(http://localhost/Mar7ba/Ontology/getRelatedConceptsAndRelations/+conceptName+/TRUE, function(data){ var concepts = data[0]; var
Suppose I have this jQuery code. $(document).delegate('a[title]', 'click', function(event) { var txt = //
i have this javascript code to which i want to add the jquery fade-in
I have this jQuery code: $(document).ready(function() { $.ajax({ url: pages/+page+.php, cache: false }).done(function( html
I have this jQuery code in my JSP page (jQuery 1.7.2) : function Header()
I have this jquery code to add the onclick event to minimize and maximize
I have this JQuery code working however I need to know whether how to
On my main page I have this jquery code which does an ajax call
I have this jQuery datepicker code that initially set the minDate of the datepicker.
I have this Javascript/JQuery code: <script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js></script> <script type=text/javascript> name = $(#name).val(); alert(Name:

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.