Vadivel Murugan Vadivel Murugan - 1 year ago 112
MySQL Question

How to update Multiple radio button value into database using id

I have listed my table(leaveform) records(50) using datatable API. In my table I have a column to approve leave. This column consist of two radio buttons(Approve and Reject). Each record have its own unique id. Now I want to update the values into database using those unique id.

This is my Table
enter image description here

Answer Source

You can create one function and that function is called by clicking on 'Approve' or 'Reject'. Let me give you example.

For e.g. : you have two radio button as below. Approve and Reject

Now, You have to create one function that will be called by clicking on radio button. as explained below.

<input type="radio" name="rndLeave" value="approve" onclick="changeLeaveStatus(leaveid, 'approve')" /> Approve

<input type="radio" name="rndLeave" value="reject" onclick="changeLeaveStatus(leaveid, 'reject')" /> Reject

// first argument is leave id

// second argument is leave status.

function changeLeaveStatus(leaveid, leaveStatus)

           url: 'leave_status.php',
           data: 'id='+leaveid+'&status='+leaveStatus,
           type: 'POST',
           success: function() {
           error: function(){


This way you can update leave status from jquery datatable.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download