Jump to content

Auto calculate inside while loop


newphpcoder

Recommended Posts

Hi...

I just want to know if it is possible to have an autocalculate in a textboxes inside while loop..

 

here is my code:

 

<html>
<head>
<style type="text/css">
#fieldset_PS{
    position: relative;
    width: 20%;
}
</style>
<link rel="stylesheet" type="text/css" href="kanban.css" /> 
<script type="text/javascript">
  
function display_PS(){
    document.loading_kanban.action="ParameterSettings.php";
    document.loading_kanban.submit();
}
function display_Kanban(){
    document.loading_kanban.action="kanban_report.php";
    document.loading_kanban.submit();
}
</script>
</head>
<?php
  error_reporting(0);
$con = mysql_connect('localhost', 'root','');

if (!$con) {
    echo 'failed';
    die();
}

mysql_select_db("mes", $con);



?>
<form name="loading_kanban">
<div id="main_button">
<center>
<!--<label style="margin-left: .9em; font-family: Arial, Helvetica, sans-serif; font-size: .7em;">Display Details:</label><input  onclick='showDetails(this);' id='chkDetail'   type='checkbox' checked='checked' value='wip'/>     -->
<input type="button" name="parameter_settings" value="Parameter Settings" onclick="display_PS()">
<input type="button" name="parameter_settings" value="Stock Requisition"> 
<input type="button" name="parameter_settings" value="Kanban Report" onclick="display_Kanban()">
</div>
<div id="fieldset_PS">
<fieldset>
<legend>Parameter Settings</legend>
</center>  
<table border="1">
<th>Compounds</th>
<th>Max</th>
<th>Min</th>
<?php
$sql = "SELECT PCODE FROM parameter_settings ORDER BY PCODE ASC";
$result = mysql_query($sql, $con);
while ($row = mysql_fetch_assoc($result)){
echo "<tr>
        <td>$row[PCODE]</td>
        <td><input type = 'text' name = 'max_pcode' size = '10'></td>
        <td><input type = 'text' name = 'min_pcode' size = '10'></td>
        </tr>";
}   
?>
</fieldset>
</table>
</div>
</form>
</html>

 

I have table : parameter settings and i have fields: PCODE, max, min

 

PCODE has data:

 

PXX

PYY

PZZ

PAA

PBB

Total

 

I just want to know how can I auto calculate the total max and total min and it will display in the textbox beside Total...

 

Thank you

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.