If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Junior Member
    Join Date
    Apr 2014
    Member #

    jQuery to update database from checkbox doesnt work, Please help..

    first of all I am new here and i wanna say hello guys. I am working on a project that is stuck right now. So the idea is I have the checkboxes generated from the oci_fetch_array() into a table and when user check the checkbox, it automatically updates the database with corresponding data and disable the checkbox.

    Here is the code, for the jQuery

    $('.cuttingCheckbox').change(function() {
                 if (this.checked) {
                    headmark : $(this).data('headmark'), 
                    headmark_id :  $(this).data('id')
                   }, function(response){
                        this.setAttribute("disabled", true), alert(headmark,headmark_id);
    And on the same page the PHP will be,
    PHP Code:
    if($_POST['action'] == 'show')
                             WHERE FABRICATION.HEAD_MARK = '
    $query oci_parse($conn$sql);
    $query_exec oci_execute($query);
    $row oci_fetch_assoc($query)){
    "<input type='hidden' id='headmarkid' value='".$row['HEAD_MARK']."' />";
    "<input type='hidden' id='rowid' value='".$row['ID']."' />";
    "<table border='1'>";
    '<table cellspacing = "0"';
    '<tr><th>Head Mark/ID</th>
                                              if (
    $row['CUTTING'] == 'Y'){                                  
    //echo "<td><input type='checkbox' id='cuttingCheckbox'  name='cuttingCheckbox' checked='checked' disabled='disabled'/></td>";
    echo "<td><img src='../images/fabDone.png' width='30' height='30'></td>";                                            
                                              } else {
    "<td><input type='checkbox' data-headmark=".$row['HEAD_MARK']." data-id=".$row['ID']." class='cuttingCheckbox'  name='cuttingCheckbox'/></td>";
    "<table cellspacing = '0'";
    //===> END OF 'SHOW' 
    this is the process_class.php to update the database based on the passing values
    PHP Code:
    $cuttingUpdateParse oci_parse($conn,"UPDATE FABRICATION_QC SET CUTTING = 'Y' 
                                           WHERE HEAD_MARK = "
    .$_POST["headmark"]." AND ID = ".$_POST["headmark_id"].";");
    $cuttingUpdateRes oci_execute($cuttingUpdateParse);

    if (
    "<script>alert('CUTTING UPDATED');</script>";
    } else {
    "<script>alert('CUTTING NOT UPDATED');</script>";

    Any kind of help will be greatly appreciated,

    thanks guys,


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Tags for this Thread

All times are GMT -6. The time now is 10:14 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: