36 users online (0 members and 36 guests)  


  Results 1 to 2 of 2

Related

  1. Replies: 1
  2. Replies: 1
  3. textfield in link    Forum: HTML Forum
    Replies: 3
  4. Width of rows in table.    Forum: CSS Forum
    Replies: 1
  1. #1
    newphpcoder's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Sep 2010
    Posts
    52

    Sum of table rows will appear in a textfield

    Good day!

    I have a problem in adding codes in my php codes, but i have the concept of codes that i want to add in my php codes, but I don't know if it is right. Kindly check my codes thank you.

    This is my whole codees:
    Code:
    <?php  
     include("config.php");  
    
     $rexist = 0;  
    
     if($_POST["clt_no"])  
    
       {  
    
        $clt_date = $_POST["clt_date"];  
    
         $query = "INSERT INTO clt_transact (clt_no, ac2l, b3, cloth_type, roll_no, transact_date, clt_date, pack_setting) VALUES ('" . $_POST["clt_no"] . "', '" . $_POST["ac2l"] . "', '" . $_POST["b3"] . "', '" . $_POST["cloth_type"] . "', '" . $_POST["roll_no"] . "', now(), '" . $clt_date . "', '" . $_POST["pack"] . "')";  
    
        $result = mysql_query($query);  
    
        $clt_transact_id = mysql_insert_id();  
    
           
    
         $opname = $_POST["opname"];  
    
         $timein = $_POST["timein"];  
    
        $timeout = $_POST["timeout"];  
    
        $inqty = $_POST["inqty"];  
         $iun = $_POST["iun"];  
    
         $outqty = $_POST["outqty"];  
    
        $oun = $_POST["oun"];  
    
         $idno = $_POST["idno"];  
    
         $mcno = $_POST["mcno"];  
    
         $varqty = $_POST["varqty"];  
    
         $varsublot = $_POST["varsublot"];  
    
        $dateshift = $_POST["dateshift"];  
    
         $shift = $_POST["shift"];  
    
           
    
         $totalarr = count($opname) - 1;  
    
        for($ctr=0; $ctr < $totalarr; $ctr++)  
    
             {  
    
            $inqty[$ctr] = (float) $inqty[$ctr];  
    
            $varqty[$ctr] = (float) $varqty[$ctr];  
           $outqty[$ctr] = (float) $outqty[$ctr];  
    
                
    
             $query = "INSERT INTO clt_traceability (operation_name, time_in, time_out, input_qty, input_unit, output_qty, output_unit, id_no, mc_no, variance_qty, variance_sublot, date, shift, clt_transact_id) VALUES ('" . $opname[$ctr] . "', '" . $timein[$ctr] . "', '" . $timeout[$ctr] . "', '" . $inqty[$ctr] . "' , '" . $iun[$ctr] . "' ,'" . $outqty[$ctr] . "', '" . $oun[$ctr] . "' , '" . $idno[$ctr] . "', '" . $mcno[$ctr] . "', '" . $varqty[$ctr] . "', '" . $varsublot[$ctr] . "', '" . $dateshift[$ctr] . "', '" . $shift[$ctr] . "', '" . $clt_transact_id . "')";  
    
             $result = mysql_query($query);  
             }     
        }  
    
     $rexist = 0;  
    
    ?>  
    
     <html>  
    
     <head>  
    
         <style type="text/css">  
    
         .myclass {  
    
         font-size: 10pt; font-family:Arial, Helvetica, sans-serif;  
    
         }  
    
        </style>  
    
            
    
            
    
         <script language="javascript">  
    
         function handleEnter(e, nextfield)  
    
             {  
    
            var characterCode = (e && e.which)? e.which: e.keyCode;  
    
             if(characterCode == 13)  
    
                 {  
    
                 document.getElementById(nextfield).focus();  
    
                return false;  
    
                 }   
    
            else 
    
                 {  
    
                return true;  
    
                }  
    
             }  
    
        </script>  
    
     </head>  
    
     <body onload="document.clttype.clt_no.focus();">  
    
        
    
     <!--<p><a href="clt_definition.php">Clt Types</a>   <a href="clt_query.php">Query</a></p>-->  
    
     <?php  
    
     include("menu.php");  
    
     ?>  
    
     <form action='clt_main.php' method="post" name="clttype">  
    
     <?php  
    
         $rexist = 1;  
    
           
    
         echo "<b>                                                                                                                    Choose One</b><br/>";  
    
         echo "Clt No:       <input type='text' name='clt_no' onkeypress='return handleEnter(event,\"clt_date\");' />";  
    
         echo "                                                             ";  
    
         echo "<input type='radio' name='pack' id='mother' value='Mother Lot'  /> Mother Lot<br />";     
    
        echo "CLT Date:  <input type='text' name='clt_date' onkeypress='return handleEnter(event,\"ac2l\");' />";  
    
         echo "                                                             ";  
    
         echo "<input type='radio' name='pack' id='child' value='Child Lot' /> Child Lot";  
    
             
    
         echo "<table>";  
    
        echo "<tr><th class='myclass'>PARTS TRACEABILITY</th><th class='myclass'>LOT/BATCH #</th></tr>";  
    
       echo "<tr><td>AC2L</td><td><input type='text' name='ac2l' id='ac2l' onkeypress='return handleEnter(event,\"b3\");' /></td></tr>";  
    
        echo "<tr><td>B3</td><td><input type='text' name='b3' id='b3' onkeypress='return handleEnter(event,\"cloth_type\");' /></td></tr>";  
    
        echo "<tr><td>Cloth Type</td><td><input type='text' name='cloth_type' id='cloth_type' onkeypress='return handleEnter(event,\"roll_no\");' /></td></tr>";  
         echo "<tr><td>Roll No</td><td><input type='text' name='roll_no' id='roll_no' onkeypress='return handleEnter(event,\"timein0\");' /></td></tr>";  
    
        echo "</table>";  
    
       echo "<p> </p>";  
    
            
    
         $query = "SELECT * FROM clt_trace_operations ORDER BY operation_name";  
    
         $last_operation_name = "";  
    
         $result = mysql_query($query);  
    
         if($result)  
    
             {  
    
             $rexist = 1;  
    
             echo "<p><center><b>OPERATOR AND MACHINE TRACEABILITY</center></b></p>";  
    
             echo "<table>";  
    
             echo "<tr><th class='myclass'>OPERATIONS</th><th class='myclass'>Time IN</th><th class='myclass'>Time OUT</th><th class='myclass'>INPUT <br/> QTY</th><th class='myclass'>UNIT</th><th class='myclass'>OUTPUT QTY</th><th class='myclass'>UNIT</th><th class='myclass'>NAME & ID #</th><th class='myclass'>MC #</th><th class='myclass'>VARIANCE Qty</th><th class='myclass'>VARIANCE Sub Lot</th><th class='myclass'>DATE</th><th class='myclass'>SHIFT</th></tr>";  
    
             $totalrows = mysql_num_rows($result);  
    
             $trows = $totalrows - 1;  
    
             for($ctr = 0; $ctr < $trows; $ctr++)  
    
                 {  
    
                 $row = mysql_fetch_array($result);  
    
                 $tctr = $ctr + 1;  
    
                 echo "\n\t<tr>";  
    
                 echo "\n\t\t<td width='800'>";  
    
                 if ($last_operation_name != $row["operation_name"]) echo $row["operation_name"];  
    
                 $last_operation_name = $row["operation_name"];  
    
                 echo "<input type='hidden' width='400' name='opname[]' value='" . $row["operation_name"] . "' /></td>";     
    
                 echo "\n\t\t<td><input size='6' type='text' name='timein[]' id='timein" . $ctr . "' onkeypress='return handleEnter(event,\"timeout" . $ctr . "\");' /></td>";  
    
                 echo "\n\t\t<td><input size='6' type='text' name='timeout[]' id='timeout" . $ctr . "' onkeypress='return handleEnter(event,\"inqty" . $ctr . "\");' /></td>";  
    
                 echo "\n\t\t<td><input size='6' type='text' name='inqty[]' id='inqty" . $ctr . "' onkeypress='return handleEnter(event,\"outqty" . $ctr . "\");' /></td>";  
    
                 echo "\n\t\t<td>" . $row["input_unit"];  
    
                 echo "<input type='hidden' name='iun[]' value='" . $row["input_unit"] . "' /></td>";  
                 echo "\n\t\t<td><input size='6' type='text' name='outqty[]' id='outqty" . $ctr . "' onkeypress='return handleEnter(event,\"idno" . $ctr . "\");' /></td>";  
                 echo "\n\t\t<td>" . $row["output_unit"];  
    
                 echo "<input type='hidden' name='oun[]' value='" . $row["output_unit"] . "'></td>";  
    
                 echo "\n\t\t<td><input size='6' type='text' name='idno[]' id='idno" . $ctr . "' onkeypress='return handleEnter(event,\"mcno" . $ctr . "\");' /></td>";  
    
                 echo "\n\t\t<td><input size='6' type='text' name='mcno[]' id='mcno" . $ctr . "' onkeypress='return handleEnter(event,\"varqty" . $ctr . "\");' /></td>";  
    
                 echo "\n\t\t<td><input size='6' type='text' name='varqty[]' id='varqty" . $ctr . "' onkeypress='return handleEnter(event,\"varsublot" . $ctr . "\");' /></td>";  
    
                 echo "\n\t\t<td><input size='6' type='text' name='varsublot[]' id='varsublot" . $ctr . "' onkeypress='return handleEnter(event,\"dateshift" . $ctr . "\");' /></td>";  
                 echo "\n\t\t<td><input size='6' type='text' name='dateshift[]' id='dateshift" . $ctr . "' onkeypress='return handleEnter(event,\"shift" . $ctr . "\");' /></td>";  
    
                echo "\n\t\t<td><input size='6' type='text' name='shift[]' id='shift" . $ctr . "' onkeypress='return handleEnter(event,\"timein" . $tctr . "\");' /></td>";  
    
                 echo "\n\t</tr>";  
    
                 }  
    
             if($totalrows > 1);  
    
                 {  
    
                 $row = mysql_fetch_array($result);  
    
                 echo "\n\t<tr>";  
                 echo "\n\t\t<td width='800'>";  
    
                 if ($last_operation_name != $row["operation_name"]) echo $row["operation_name"];  
    
                 $last_operation_name = $row["operation_name"];  
    
                 echo "<input type='hidden' width='400' name='opname[]' value='" . $row["operation_name"] . "' /></td>";     
    
                 echo "<input type='hidden' name='opname[]' value='" . $row["operation_name"] . "' /></td>";  
    
                 echo "\n\t\t<td><input size='6' type='text' name='timein[]' id='timein" . $ctr . "' onkeypress='return handleEnter(event,\"timeout" . $ctr . "\");' /></td>";  
    
                 echo "\n\t\t<td><input size='6' type='text' name='timeout[]' id='timeout" . $ctr . "' onkeypress='return handleEnter(event,\"inqty" . $ctr . "\");' /></td>";  
    
                 echo "\n\t\t<td><input size='6' type='text' name='inqty[]' id='inqty"  . $ctr . "' onkeypress='return handleEnter(event,\"outqty" . $ctr . "\");' /></td>";  
                 echo "\n\t\t<td>" . $row["input_unit"];  
    
                 echo "<input type='hidden' name='iun[]' value='" . $row["input_unit"] . "' /></td>";  
    
                 echo "\n\t\t<td><input size='6' type='text' name='outqty[]' id='outqty" . $ctr . "' onkeypress='return handleEnter(event,\"idno" . $ctr . "\");' /></td>";  
    
                 echo "\n\t\t<td>" . $row["output_unit"];  
    
                 echo "<input type='hidden' name='oun[]' value='" . $row["output_unit"] . "'></td>";  
                 echo "\n\t\t<td><input size='6' type='text' name='idno[]' id='idno" . $ctr . "' onkeypress='return handleEnter(event,\"mcno" . $ctr . "\");' /></td>";  
    
                 echo "\n\t\t<td><input size='6' type='text' name='mcno[]' id='mcno" . $ctr . "' onkeypress='return handleEnter(event,\"varqty" . $ctr . "\");' /></td>";  
                 echo "\n\t\t<td><input size='6' type='text' name='varqty[]' id='varqty" . $ctr . "' onkeypress='return handleEnter(event,\"varsublot" . $ctr . "\");' /></td>";  
    
                 echo "\n\t\t<td><input size='6' type='text' name='varsublot[]' id='varsublot" . $ctr . "' onkeypress='return handleEnter(event,\"dateshift" . $ctr . "\");' /></td>";  
                 echo "\n\t\t<td><input size='6' type='text' name='dateshift[]' id='dateshift" . $ctr . "' onkeypress='return handleEnter(event,\"shift" . $ctr . "\");' /></td>";  
                 echo "\n\t\t<td><input size='6' type='text' name='shift[]' id='shift" . $ctr . "' onkeypress='return handleEnter(event,\"saveform\");' /></td>";  
                 echo "\n\t</tr>";  
                 }  
             echo "</table>";  
             }         
        
    
         echo "<p><input type='submit' value='  Save  ' id='saveform' /></p>";  
         echo "<input type='hidden' name='clt_typeno' value='" . $_POST["clt_typeno"] . "' />";  
     ?>  
    
     </form>  
    
     </body>  
        </html>
    and here is the codes I want to add:
    Code:
    <?php
      if($_POST["clt_no"])
        {
        $query = "SELECT * FROM clt_transact WHERE  clt_no = '" . $_POST . "'";
        $result_no = mysql_query($query);
            if($result_no)
                {
                if(mysql_num_rows($result_no) > 0 )
                $operation2_input = 0;
                
                $query = "SELECT SUM(t.input_qty) AS operation_input FROM clt_traceability t, clt_transact p WHERE t.clt_transact_id = p.clt_transact_id AND t.operation_name 'Operation2' AND p.clt_no='" . $_POST["clt_no"] . "'";
                $resultyield = mysql_query($query);
                if($resultyield)
                    {
                        if(mysql_num_rows($resultyield) > 0)$operation2_input =mysql_result($resultyield,0,"operation2_input");
                    }
                  $operation2_total = $operation2_input;
                }
        }
    ?>
    I want to happen is all the input qty that the user insert in input qty textfield will sum and the result will appear in operation2_total in input_qty textfield.

    I don't know how thus the result should be appear automatically in the input qty of operation2_total and if my code is correct.

    Thank you
    Last edited by newphpcoder; 12-13-2010 at 04:30 AM.

  2. #2
    newphpcoder's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Sep 2010
    Posts
    52

    Re: Sum of table rows will appear in a textfield

    I have 5 operation name: operation1,operation2,operation2_total,operation3,operation4,operation5. As you notice I have a operation2_total

    How can I add the input qty of operation2 and the result will be appear in input_qty of operation2_total.

    PHP Code:
    <?php
    include("config.php");
    $rexist 0;
    if(
    $_POST["clt_no"])
        {
        
    $clt_date $_POST["clt_date"];
        
    $query "INSERT INTO clt_transact (clt_no, ac2l, b3, cloth_type, roll_no, transact_date, clt_date, pack_setting) VALUES ('" $_POST["clt_no"] . "', '" $_POST["ac2l"] . "', '" $_POST["b3"] . "', '" $_POST["cloth_type"] . "', '" $_POST["roll_no"] . "', now(), '" $clt_date "', '" $_POST["pack"] . "')";
        
    $result mysql_query($query);
        
    $clt_transact_id mysql_insert_id();
        
        
    $opname $_POST["opname"];
        
    $timein $_POST["timein"];
        
    $timeout $_POST["timeout"];
        
    $inqty $_POST["inqty"];
        
    $iun $_POST["iun"];
        
    $outqty $_POST["outqty"];
        
    $oun $_POST["oun"];
        
    $idno $_POST["idno"];
        
    $mcno $_POST["mcno"];
        
    $varqty $_POST["varqty"];
        
    $varsublot $_POST["varsublot"];
        
    $dateshift $_POST["dateshift"];
        
    $shift $_POST["shift"];
        
        
        
    $totalarr count($opname) - 1;
        for(
    $ctr=0$ctr $totalarr$ctr++)
            {
            
    $inqty[$ctr] = (float) $inqty[$ctr];
            
    $varqty[$ctr] = (float) $varqty[$ctr];
            
    $outqty[$ctr] = (float) $outqty[$ctr];
             
            
    $query "INSERT INTO clt_traceability (operation_name, time_in, time_out, input_qty, input_unit, output_qty, output_unit, id_no, mc_no, variance_qty, variance_sublot, date, shift, clt_transact_id) VALUES ('" $opname[$ctr] . "', '" $timein[$ctr] . "', '" $timeout[$ctr] . "', '" $inqty[$ctr] . "' , '" $iun[$ctr] . "' ,'" $outqty[$ctr] . "', '" $oun[$ctr] . "' , '" $idno[$ctr] . "', '" $mcno[$ctr] . "', '" $varqty[$ctr] . "', '" $varsublot[$ctr] . "', '" $dateshift[$ctr] . "', '" $shift[$ctr] . "', '" $clt_transact_id "')";
            
    $result mysql_query($query);
            }   
        }
    $rexist 0;
    ?>
    <html>
    <head>
        <style type="text/css">
        .myclass {
         font-size: 10pt; font-family:Arial, Helvetica, sans-serif;
        }
        </style>
        
        <script type="text/javascript">
    document.onkeypress = function(e){
        e = e || event; e.returnValue = true;
        var t = e.target || e.srcElement, re = /^(inqty|outqty)(\d+)$/, f = arguments.callee, m, i;
        function next(){
            if(!f.els && (m = t.form) === document.forms.clttype){
                var ipts = m.getElementsByTagName('input'), els = []; i = ipts.length - 1;
                for (i; i > -1; --i){
                    if(ipts[i].type && ipts[i].type.toLowerCase() === 'text'){
                        els.push(ipts[i]);
                    }
                }
                f.els = els;
            }
            if(f.els){
                i = f.els.length - 1;
                for (i; i > -1; --i){
                    if(f.els[i] === t && (m = f.els[i - 1])){
                        m.focus();
                    }
                }
            }
        }
        if((m = re.exec(t.id)) && e.keyCode === 13){
            e.returnValue = false;
            t.form.elements['varqty' + m[2]].value = t.form.elements['inqty' + m[2]].value - t.form.elements['outqty' + m[2]].value;
        } else if (t.type && e.keyCode === 13 && t.type.toLowerCase() !== 'submit') {
            e.returnValue = false;
        }
        if(!e.returnValue){
            next();
            if(e.preventDefault){e.preventDefault();}
        }
        return e.returnValue;
    }
    </script>
    </head>
    <body>

    <!--<p><a href="clt_definition.php">Clt Types</a>&nbsp;&nbsp;&nbsp;<a href="clt_query.php">Query</a></p>-->
    <?php
    include("menu.php");
    ?>
    <form action='clt_main.php' method="post" name="clttype">

    <?php
        $rexist 
    1;
        
        echo 
    "<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Choose One</b><br/>";
        echo 
    "Clt No:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='text' name='clt_no' />";
        echo 
    "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        echo 
    "<input type='radio' name='pack' id='mother' value='Mother Lot'  /> Mother Lot<br />";   
        echo 
    "CLT Date:&nbsp;&nbsp;<input type='text' name='clt_date' />";
        echo 
    "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        echo 
    "<input type='radio' name='pack' id='child' value='Child Lot' /> Child Lot";
          
        echo 
    "<table>";
        echo 
    "<tr><th class='myclass'>PARTS TRACEABILITY</th><th class='myclass'>LOT/BATCH #</th></tr>";
        echo 
    "<tr><td>AC2L</td><td><input type='text' name='ac2l' id='ac2l' /></td></tr>";
        echo 
    "<tr><td>B3</td><td><input type='text' name='b3' id='b3' /></td></tr>";
        echo 
    "<tr><td>Cloth Type</td><td><input type='text' name='cloth_type' id='cloth_type' /></td></tr>";
        echo 
    "<tr><td>Roll No</td><td><input type='text' name='roll_no' id='roll_no' /></td></tr>";
        echo 
    "</table>";
        echo 
    "<p>&nbsp;</p>";
        
        
    $query "SELECT * FROM clt_trace_operations ORDER BY operation_name";
        
    $last_operation_name "";
        
    $result mysql_query($query);
        if(
    $result)
            {
            
    $rexist 1;
            echo 
    "<p><center><b>OPERATOR AND MACHINE TRACEABILITY</center></b></p>";
            echo 
    "<table>";
            echo 
    "<tr><th class='myclass'>OPERATIONS</th><th class='myclass'>Time IN</th><th class='myclass'>Time OUT</th><th class='myclass'>INPUT <br/> QTY</th><th class='myclass'>UNIT</th><th class='myclass'>OUTPUT QTY</th><th class='myclass'>UNIT</th><th class='myclass'>NAME & ID #</th><th class='myclass'>MC #</th><th class='myclass'>VARIANCE Qty</th><th class='myclass'>VARIANCE Sub Lot</th><th class='myclass'>DATE</th><th class='myclass'>SHIFT</th></tr>";
            
    $totalrows mysql_num_rows($result);
            
    $trows $totalrows 1;
            for(
    $ctr 0$ctr $trows$ctr++)
                {
                
    $row mysql_fetch_array($result);
                
    $tctr $ctr 1;
                echo 
    "\n\t<tr>";
                echo 
    "\n\t\t<td width='800'>";
                if (
    $last_operation_name != $row["operation_name"]) echo $row["operation_name"];
                
    $last_operation_name $row["operation_name"];
                echo 
    "<input type='hidden' width='400' name='opname[]' value='" $row["operation_name"] . "' /></td>";   
                echo 
    "\n\t\t<td><input size='6' type='text' name='timein[]' id='timein" $ctr "' /></td>";
                echo 
    "\n\t\t<td><input size='6' type='text' name='timeout[]' id='timeout" $ctr "' /></td>";
                echo 
    "\n\t\t<td><input size='6' type='text' name='inqty[]' id='inqty" $ctr "' /></td>";
                echo 
    "\n\t\t<td>" $row["input_unit"];
                echo 
    "<input type='hidden' name='iun[]' value='" $row["input_unit"] . "' /></td>";
                echo 
    "\n\t\t<td><input size='6' type='text' name='outqty[]' id='outqty" $ctr "' ></td>";
                echo 
    "\n\t\t<td>" $row["output_unit"];
                echo 
    "<input type='hidden' name='oun[]' value='" $row["output_unit"] . "'></td>";
                echo 
    "\n\t\t<td><input size='6' type='text' name='idno[]' id='idno" $ctr "' /></td>";
                echo 
    "\n\t\t<td><input size='6' type='text' name='mcno[]' id='mcno" $ctr "'  /></td>";
                echo 
    "\n\t\t<td><input size='6' type='text' name='varqty[]' id='varqty" $ctr "' /></td>";
                echo 
    "\n\t\t<td><input size='6' type='text' name='varsublot[]' id='varsublot" $ctr "'  /></td>";
                echo 
    "\n\t\t<td><input size='6' type='text' name='dateshift[]' id='dateshift" $ctr "'  /></td>";
               echo 
    "\n\t\t<td><input size='6' type='text' name='shift[]' id='shift" $ctr "' /></td>";
                echo 
    "\n\t</tr>";
                }
            if(
    $totalrows 1);
                {
                
    $row mysql_fetch_array($result);
                echo 
    "\n\t<tr>";
                echo 
    "\n\t\t<td width='800'>";
                if (
    $last_operation_name != $row["operation_name"]) echo $row["operation_name"];
                
    $last_operation_name $row["operation_name"];
                echo 
    "<input type='hidden' width='400' name='opname[]' value='" $row["operation_name"] . "' /></td>";   
                echo 
    "<input type='hidden' name='opname[]' value='" $row["operation_name"] . "' /></td>";
                echo 
    "\n\t\t<td><input size='6' type='text' name='timein[]' id='timein" $ctr "'  /></td>";
                echo 
    "\n\t\t<td><input size='6' type='text' name='timeout[]' id='timeout" $ctr "'  /></td>";
                echo 
    "\n\t\t<td><input size='6' type='text' name='inqty[]' id='inqty"  $ctr "' /></td>";
                echo 
    "\n\t\t<td>" $row["input_unit"];
                echo 
    "<input type='hidden' name='iun[]' value='" $row["input_unit"] . "' /></td>";
                echo 
    "\n\t\t<td><input size='6' type='text' name='outqty[]'  id='outqty" $ctr "'  /></td>";
                echo 
    "\n\t\t<td>" $row["output_unit"];
                echo 
    "<input type='hidden' name='oun[]' value='" $row["output_unit"] . "'></td>";
                echo 
    "\n\t\t<td><input size='6' type='text' name='idno[]' id='idno" $ctr "'  /></td>";
                echo 
    "\n\t\t<td><input size='6' type='text' name='mcno[]' id='mcno" $ctr "'  /></td>";
                echo 
    "\n\t\t<td><input size='6' type='text' name='varqty[]' value=''  id='varqty" $ctr "' /></td>";
                echo 
    "\n\t\t<td><input size='6' type='text' name='varsublot[]' id='varsublot" $ctr "'  /></td>";
                echo 
    "\n\t\t<td><input size='6' type='text' name='dateshift[]' id='dateshift" $ctr "'  /></td>";
                echo 
    "\n\t\t<td><input size='6' type='text' name='shift[]' id='shift" $ctr "'  /></td>";
                echo 
    "\n\t</tr>";
                }
            echo 
    "</table>";
            }       

        echo 
    "<p><input type='submit' value='  Save  ' id='saveform' /></p>";
        echo 
    "<input type='hidden' name='clt_typeno' value='" $_POST["clt_typeno"] . "' />";
    ?>
    </form>
    </body>
    </html>