• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 95
  • Last Modified:

js datatable, and checkbox

https://jsfiddle.net/gyrocode/07Lrpqm7/

I use above datatable source code and when the submit button is clicked, it capture the value, but it shown
id=1, id=2, id=3 and etc.

I wonder how to capture them when I need to save those record into the ms sql database.
0
ITsolutionWizard
Asked:
ITsolutionWizard
  • 4
  • 2
1 Solution
 
Marco GasiFreelancerCommented:
Do you mean this?
if (isset($_POST['id'])){
    $ids = $_POST['id'];
    foreach ($ids as $id){
        //do something with id values, i.e. build a query to insert values in the db
    } 
}

Open in new window

Keep in mind you have to remove the lines which are for testing only: don't serialize values and comment out the e.preventDefault so to allow the form to be submitted.
0
 
ITsolutionWizardAuthor Commented:
In your comment line, I need some helps how to capture the value.
0
 
Marco GasiFreelancerCommented:
The value is in $id variable. How to capture it depends on what you want to do with the values: build an array to use in nother function, insert or update records in a database... Please, clarify this so I can suggest something
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
ITsolutionWizardAuthor Commented:
can you show me how to get array for $id ?
0
 
Marco GasiFreelancerCommented:
In my code above, the array is in the variable $ids created from the global $_POST['id'].
But I suspect I misunderstood your question: what do you mean with
get array for $id
?
Are you talking about php or javascript? I thought you wanted php code since you said you have to insert data in mssql.
Can you explain exactly the workflow?
0
 
Marco GasiFreelancerCommented:
Without any additional information, I think this comment perfectly answers to the question.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now