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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:19:24+00:00 2026-06-05T07:19:24+00:00

I am having a download as csv button for exporting the results as csv.

  • 0

I am having a download as csv button for exporting the results as csv. Till now I was using server side code for this. I was sending the selected DropDowns Ids to csvdownload.php page which is writing the results in excel.

BUT NOW, I want a utility for selecting the search results using checkbox and then the selected results should written to the csv.

I am planning to get the table data in array and then post it to php using ajax, then it will do the rest of things. But how is this possible to post multiple rows of data to php. I have following piece of code for getting the table data which is alerting data but dont know how to make it as array and pass to php

      $('#tblSearchResults tr').filter(':has(:checkbox:checked)').each(function() {
     $tr = $(this);
       //alert($tr.find("td").eq(4).html());

        var risk_cat = $tr.find("td").eq(1).html();
        var risk_type = $tr.find("td").eq(2).html();
        var risk_desc = $tr.find("td").eq(3).html();
        var treat_desc = $tr.find("td").eq(4).html();
        var treat_cat = $tr.find("td").eq(5).html();

        selectedData.push({"risk_cat": risk_cat, "risk_type": risk_type, "risk_desc": risk_desc, "treat_desc": treat_desc, "treat_cat": treat_cat});

thanks

  • 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-05T07:19:26+00:00Added an answer on June 5, 2026 at 7:19 am

    I think you need to use JSON.stringify(selectedData) in order to use it on the serverside.

    jQuery:

    var obj = { 'risk_cat': risk_cat, 'risk_type': risk_type };
    selectedData.push(obj);
    
    $.post('serive.php', { DTO: JSON.stringify(selectedData) }, 
    function(data){ /* handle response,  */ });
    

    service.php:

    header('Content-type: application/json');
    header('Cache-Control: no-cache, must-revalidate');
    
    $foo = json_decode($_POST['DTO']);
    
    
    $arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5); //example data
    
    echo json_encode($arr);
    

    This should get you started. In your ajax reponse, alert(data.a) would be alerting “1”

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

Sidebar

Related Questions

I am having to code up a button which, onclick, downloads a csv file
I am having difficulty downloading the Android source code using the recommended instructions, due
I'm having a bit of trouble exporting a csv file that is created from
I want to parse the contents of a dynamic .csv file. However, this code
I have been having problems with creating a download list of files for a
having same issue, i am totally new in php. i install XAMPP then download
Our application downloads data from the internet using RSS but is having connection problems
After having the unpleasant surprise that Comma Seperated Value (CSV) files are not necessarily
I am using RCurl in R to try and download data from a website,
I am having an error in my program when trying to download files from

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.