Solved

js datatable, and checkbox

Posted on 2016-07-29
6
46 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
  • 4
  • 2
6 Comments
 
LVL 31

Accepted Solution

by:
Marco Gasi earned 500 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
 

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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
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…

863 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now