js datatable, and checkbox


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.
Who is Participating?
Marco GasiConnect With a Mentor FreelancerCommented:
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.
ITsolutionWizardAuthor Commented:
In your comment line, I need some helps how to capture the value.
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
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

ITsolutionWizardAuthor Commented:
can you show me how to get array for $id ?
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?
Marco GasiFreelancerCommented:
Without any additional information, I think this comment perfectly answers to the question.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.