0

Hi there,

I need a help on how to pass php variable to another page when the checkbox is clicked. so far i hav this

<html>
    <head>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
        <script type="text/javascript">

        $('.cuttingCheckbox').change(function() {
            if (this.checked) {
                 $.post('fabProcess.php', {
                 headmark : $($row[HEADMARK]).val(),
                 headmark_id : $($row[ID]).val()
            }, function(response){
                 this.setAttribute("disabled", true),
                         alert(headmark,headmark_id);
            });            
            } 
           });

        $('.assemblyCheckbox').change(function() {
             if (this.checked) {
               this.setAttribute("disabled", true);
             } 
           });


        </script>

        <link rel="stylesheet" type="text/css" href="../css/showFab.css">
    </head>

    <?php                

    // IF SHOW KEY HAS BEEN PRESSED
    if($_POST['action'] == 'show')
        {            
        $sql   = "SELECT * FROM SUB_MASTER_DRAWING
                          WHERE SUB_MASTER_DRAWING.HEAD_MARK = '{$_POST["hm"]}'";

        $query = oci_parse($conn, $sql);
                $query_exec = oci_execute($query);

               echo "<table border='1'>";
        while($row = oci_fetch_assoc($query)){


            echo '<div id="content">';
                            echo '<table cellspacing = "0"';
                                echo '<tr><th>Head Mark</th>
                                          <th>Cutting</th>
                                          <th>Assembly</th>

                                          </tr>';

                                echo "<tr><td><b>$row[HEAD_MARK]/$row[ID]</b></td>";

                                          if ($row['CUTTING'] == 'Y'){                                   
                                              echo "<td><input type='checkbox' id='cuttingCheckbox'  name='cuttingCheckbox' checked='checked' disabled='disabled'/></td>";
                                          } else {
                                              echo "<td><input type='checkbox' class='cuttingCheckbox'  name='cuttingCheckbox' /></td>";
                                          }   


                                          if ($row['ASSEMBLY'] == 'Y'){                                   
                                              echo "<td><input type='checkbox' id='assemblyCheckbox'  name='check' checked='checked' disabled='disabled'/></td>";
                                          } else {
                                              echo "<td><input type='checkbox' class='assemblyCheckbox'  name='check' /></td>";
                                          }        
                                        echo "</tr>";     
                                echo '<table cellspacing = "0"';
                        echo '</div>';}
        echo "</table>";
     }//===> END OF 'SHOW'
?>
</html>

So basically it shows occurence from the database and I want to pass $row[HEADMARK] and $row[ID] to another page for updating the value to database.

Please help me, any kind of help will greatly appreciated

2
Contributors
1
Reply
10
Views
3 Years
Discussion Span
Last Post by vsmash
0

What is not working for you?
the best way to pass your form variables is to serialize them.
eg:

var formdata=$("#formid").serialize();



$('.cuttingCheckbox').change(function() {
            if (this.checked) {
                 $.post('fabProcess.php', data: formdata, function(response){
                 this.setAttribute("disabled", true)
                });            
            } 
           });

ps: in your current codethis.setAttribute("disabled", true), should have a semicolon after it rather than a comma.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.