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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:53:22+00:00 2026-06-03T22:53:22+00:00

How can I send multiple values to be picked up like this using JSON?

  • 0

How can I send multiple values to be picked up like this using JSON?

foreach($_POST['listItem'] as $key => $values){

    list($eventDate, $eventTitle) = $values;

}

At the moment the values are sent as follows. But this doesn’t appear to work properly as it is only sending some of the string. I also can’t figure out where/how to send the caltitle value.

This is sending me crazy. Any help would be great.

var txt = $("#listbox");

            var caltitle = copiedEventObject.title

            var dtstart = $.fullCalendar.formatDate(copiedEventObject.start, 'yyyyMMdd');

            var txt = $('#listbox');     
            txt.append("<li class ='listItem'> " + dtstart + "</li>")

            // remove the element from the "Draggable Events" list
            $(this).remove();           

        }
    });


        $('#calendarform').submit(function(e) {
            var form = $(this);
            var listItems = $('.listItem'); 
            listItems.each(function(index){   //For each event do this:
                var listItem = $(this);
                    $("<input type='hidden'/>").val(listItem.text()).appendTo(form).attr('name', 'listItem[' + index + ']');
                });

            //Get text information from elements

        });

EDIT:

(using JSON)

  $('#calendarform').submit(function(e) {
            var form = $(this);

            var going_to_be_json = [];
            list.each(function(i, item) {
              going_to_be_json.push({
                 'id':'test',
                 'title': 'test'
              });
            });

            $('#stuff').val( JSON.stringify(going_to_be_json) );

     });
  • 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-03T22:53:24+00:00Added an answer on June 3, 2026 at 10:53 pm

    Prepare the data into an array of objects then convert that array to JSON using JSON.stringify() and set the hidden form value to said string (or use XHR to submit it to the server).

    Here is a very limited example of how to prepare the data:

    var going_to_be_json = [];
    list.each(function(i, item) {
      going_to_be_json.push({
         'id':item.id,
         'title': item.title,
         'date': (new Date()).now()
      });
    });
    hidden_form_element.val( JSON.stringify(going_to_be_json) );
    

    and on the server

    <?php
    $json_data_string = $_POST['hidden_form_field_containing_json_data']; // sanitize however
    $array_data = json_decode($json_data_string);
    

    More can be ready about JSON (Javascript Object Notation) from json.org and the Tag Wiki (although the tag wiki just shows you more examples and links)

    it seems you needed a little more direction. I was hoping you wouldn’t just copy and paste what I had and you would read and attempt to understand what it is doing….

       $('#calendarform').submit(function(e) {
            var form = $(this),
                listItems = $('.listItem'),
                data = [],
                hidden = $('<input />'); // create a hidden field for the form.
                                        // or just select the hidden form element from the page
            hidden[0].type = 'hidden'; // set the type
            hidden[0].name = 'some_name_for_php_to_recognize'; // and name
    
            listItems.each(function(i,el){ 
                 data.push({'index': i, 'text': $(el).text()});
            });
    
            hidden.val(JSON.stringify(data));
            $(this).append(hidden); // not needed if the hidden element is already in the DOM
    
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can send requests to friends using Multi Friend Request Selector inside my Page
how i can send key from my C# program to external program ? ex:
Using cURL I can send a GET request with a body. Example: curl -i
Is there any way I can send an email, like any frameworks or something.
How to send HTML content in email using Python? I can send simple texts.
I'd like to use JMeter test that I can send a message to a
I am trying to send the same parameter name with multiple values, but even
Does anybody know how i can get multiple popups sent via notify-send to appear
In Javascript I can send XML string to JSP server (XmlAction.jsp): Javascript Code: var
how i can send sms from asp.net?any idea about it?or any resource through which

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.