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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:45:04+00:00 2026-06-03T11:45:04+00:00

I am creating a popup dialog box where I need to put a set

  • 0

I am creating a popup dialog box where I need to put a set of values in hidden format, but when I am getting the value in AJAX post, I am getting only last value.

this is the PHP part:

$plan_ids=array();
foreach($test_plan as $plan)
{
    $plan_ids[]=$plan['plan_id'];
}
?>

<?php
foreach($plan_ids as $id)
{
    echo "<input type='hidden' id='plan_id' value='$id'>";
}
//var_dump($plan_ids);
// echo $plan['plan_id'];
?>

In the AJAX part I am doing:

$("#save").click(function () {
    var name = $('#name').val();
    var id = $('#release_id').val();
    var plan_id = $('#plan_id').val();
    //alert('hello');
    $.ajax({
        type: 'POST',
        url: '/api/api.php?action=put_iteration&name=' + name + '&id=' + id + '&plan_id=' + plan_id,
        data: "name=" + name + "&id=" + id + "&plan_id=" + plan_id,
        success: function () {
            $('#save').hide(function () {
                $('div.success').fadeIn();
            });
        }
    });
});

I’m clueless about HTML hidden fields.

  • 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-03T11:45:06+00:00Added an answer on June 3, 2026 at 11:45 am

    you can name all your hidden fields like an array name="plan_id[]"

    And instead of passing it as a string you can have a wrapping FORM around hidden fields and then use jquery serialize function to POST it

    Now you will get all the plan_id in the form of an array in the POST variable

    Adding an example

    <?php
    echo '<form name="planidform" id="planidform">';
    foreach($plan_ids as $id)
    {
        echo "<input type='hidden' name="plan_id[]" value='$id'>";
    }
    echo '</form>';
    ?>
    

    After than in jQuery do it in following manner:

    data: "name=" + name + "&id=" + id + "&"+$("#planidform").serialize(),
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating JQuery dialog boxes and need the close functionality to cause a
I am creating a popup dialog using microsoft's WPF. The thing is that this
I am creating a popup jquery ajax comment form using the jquery validation plugin.
I am creating a popup jquery ajax comment form using the jquery validation plugin.
I use PopupWindow class for creating custom popup window. But when I add layout_margin
I found WaitForPageToLoad,WaitForCondition and popup. I have an ajax request which is creating some
I am creating a pop up dialog box ( UIAlertView ). It works great,
I'm creating a popup dialog using jQueryUI. I have run into problems because I'm
I'm creating a non-intrusive popup window to notify the user when processing a time-consuming
I read this article regarding creating popup notes with javascript and css The problem

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.