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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:12:17+00:00 2026-05-12T16:12:17+00:00

I have a table of data on my page. The columns are start, end,

  • 0

I have a table of data on my page. The columns are “start”, “end”, “comment”, and “options”. Within the options column is a button to delete the row, and a button that makes a row of the table editable. This allows the values of “start”, “end”, and “comment” to be changed. Clicking it again finishes the editing process. Finally, there is a way to add another row to the table. All of this works as expected.

I want to add a button at the bottom that creates an array out of the data in the table, that looks like this (represented as JSON purely for ease of showing to SO: not required):

[
    {
        "start"     :"2009/08/01",
        "end"       :"2009/08/08",
        "comment"   :"an example date.",
    },
    {
        "start"     :"2009/07/01",
        "end"       :"2009/07/08",
        "comment"   :"another example date, a month earlier.",
    },
    {
        "start"     :"2000/07/01",
        "end"       :"2000/07/08",
        "comment"   :"another example date, a year earlier. You get the idea.",
    }
]

I shouldn’t have too much trouble building the array, but once I have, how can I post it to a backend php script (which will then use put_csv() to write the data to a file)? Ideally, it would be availiable server-side in a array format, to allow validation.

I’m happy to use jquery, if it’s required.

  • 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-12T16:12:17+00:00Added an answer on May 12, 2026 at 4:12 pm

    How you end it to the server depends on what do you want to archieve. If you want to load a new page, which will process the data, you can use an usual form with hidden inputs. Alternatively, if you want to process is in the background via AJAX, use jQuery.ajax as CRasco said. Either way you use, you need to convert the structured array into a simple key/value list.

    One option is to generate a JSON document (I don’t think jQuery provides a function for this, but you can easily find something) and use a single field with the serialized document. Then on the server side you would use json_decode to get the array back. If you are using the AJAX method, the data option in jQuery.ajax call would contain:

    {
        'data': '[{"start":"2009/08/01","end":"2009/08/08","comment":"an example date."},...'
    }
    

    A better approach would be to serialize it into a list of fields in a format that PHP natively understands. That means you have to do nothing special, and $_POST['data'] will contain the array. For example:

    {
        'data[0][start]': '2009/08/01',
        'data[0][end]': '2009/08/08',
        'data[0][comment]': 'an example date.',
        'data[1][start]': '2009/07/01',
        'data[1][end]': '2009/07/08',
        'data[1][comment]': 'another example date, a month earlier.',
        ... 
    }
    

    If you are using the form method, you need to generate input fields like:

    <input type="hidden" name="data[0][start]" value="2009/08/01" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table of data that I need to dynamically add a column
I have a table that has a number of columns. For each row, I'd
I have a table on my jsp page that will have a column populated
Currently have a table .. and need to start adding new data columns to
I have a table of four columns. The data in the first column is
I have tried to find a table with class data in a web page
When showing data from a mysql table on an php page does it have
I have table of data that is sorted as follows: Item | Sample |
I have table in data base name train delay, with columns train number(int), DelayTime(int),
I have data table containing one column as FilePath. FilePath D:\New folder\link.txt D:\New folder\SharepointMigration(Work

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.