?
Solved

js datatable, and checkbox

Posted on 2016-07-29
6
Medium Priority
?
79 Views
Last Modified: 2016-08-30
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
Comment
Question by:ITsolutionWizard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 31

Accepted Solution

by:
Marco Gasi earned 2000 total points (awarded by participants)
ID: 41735776
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
 
LVL 1

Author Comment

by:ITsolutionWizard
ID: 41740075
In your comment line, I need some helps how to capture the value.
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 41740221
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
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

 
LVL 1

Author Comment

by:ITsolutionWizard
ID: 41751439
can you show me how to get array for $id ?
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 41751663
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
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 41776005
Without any additional information, I think this comment perfectly answers to the question.
0

Featured Post

Stack Overflow Podcast - Developer Story

Welcome to the Stack Overflow podcast recorded Thursday July 20 at Stack Overflow Headquearters in NYC. Your hosts today are podcast regulars Jay Hanlon, David Fullerton, and Ilana Yitzhaki, plus the quite irregular Matt Sherman (Stack Overflow Engineering Manager extraordinaire)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question