help with recordsets and user entered values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maximillion511
    New Member
    • Jul 2008
    • 22

    help with recordsets and user entered values

    Hello to all and thanks for your help in advance.

    I am having been fighting with this problem for a couple of days now and after much unsuccessful research, I am still looking for an answer. So here it is. I have 9 hidden fields(qty12,24 ,36,72,144,288, 576,1008,2016) on a form containing recordsets pulled from a mySQL database. The values from the database are there... (now we get to the problem.) I have a text box called quantity where a user inputs how many of a particular product they desire. if the user enters a number less than or equal to 12 it has to be multiplied by qty12 if its 13-24 it must use recordset qty24, if its between 25-36 it must use qty36 and so on all the way out to 2016. This is what I have written so far any help would be greatly appreciated.

    Code:
    function getCalc(){  	
    var f = document.prodform.quantity.value; 	 	
    var g = document.prodform.qty12.value; 	
    var h = document.prodform.qty24.value; 	
    var j = document.prodform.qty36.value; 	
    var k = document.prodform.qty72.value; 	
    var l = document.prodform.qty144.value; 	
    var m = document.prodform.qty288.value; 	
    var n = document.prodform.qty576.value; 	
    var o = document.prodform.qty1008.value; 	
    var p = document.prodform.qty2016.value;         
    if(f >= 12){                 
    Number(f * g);         
    }else if
    (f < 24){               
     Number(f * h);         
    }else if
    (f < 36){                 
    Number(f * j);         
    }else if(f < 72){                 
    Number(f * k);         
    }else if(f < 144){                 
    Number(f * l);         
    }else if(f < 288){                 
    Number(f * m);         
    }else if(f < 576){                 
    Number(f * n);          
    }else if(f < 1008){                 
    Number(f * o);         
    }else if(f < 2016){                 
    Number(f * p);         
    }            
    
    } 	
    
    alert (document.prodform.price.value);
    The alert is only there so that I could make sure that everything worked. it will be removed and the value will be placed in a text box.

    I am sure that there is a much easier way to do, any suggestions or places to go for research would be great! Again thank you all.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    You need to use parseInt to convert a string into an integer.

    On line 12, it should be <=, not >=. Also, it's always a good idea to use meaningful variable names.

    You could probably shorten the code using arrays, but in this case, it's just about manageable, so should be OK with the if-statements.

    Comment

    • maximillion511
      New Member
      • Jul 2008
      • 22

      #3
      acoder thanks for the speedy reply. i am new javascript programming and i am not completely sure what you mean. the parseint functions converts which string? the user entered quantity? or the recordset? about the meaningful variables i get what you're saying. i will be changing those now.



      Originally posted by acoder
      You need to use parseInt to convert a string into an integer.

      On line 12, it should be <=, not >=. Also, it's always a good idea to use meaningful variable names.

      You could probably shorten the code using arrays, but in this case, it's just about manageable, so should be OK with the if-statements.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        The user entered quantity, e.g.
        Code:
        function getCalc(){  	
        var quantity = parseInt(document.prodform.quantity.value);
        //...
        if (quantity <= 12) {
        price = quantity * qty12;
        } else if...

        Comment

        • maximillion511
          New Member
          • Jul 2008
          • 22

          #5
          acoder this is what i did with what you sent me... unfortunately, it doesnt work in IE or FF (havent even bothered to check safari) any ideas????

          thanks again for all the help. Maybe it's because the values from the recordsets have decimals?? also i need to be able to show these as currency values and not just integers...


          Code:
          function getCalc(){ 	 	
          var qty = parseInt(document.prodform.quantity.value); 	 	
          var qty12=document.prodform.qty12.value; 	
          var qty24=document.prodform.qty24.value; 	
          var qty36=document.prodform.qty36.value; 	
          var qty72=document.prodform.qty72.value; 	
          var qty144=document.prodform.qty144.value; 	
          var qty288=document.prodform.qty288.value; 	
          var qty576=document.prodform.qty576.value; 	
          var qty1008=document.prodform.qty1008.value; 	
          var qty2016=document.prodform.qty2016.value; 	 	
          var price = document.prodform.price.value;  		
          if(qty >= 12){ 		 					   
          price = Number(qty * qty12); 		 			   
          }else if 					
          (qty <= 24){ 		 					  
          price = Number(qty * qty24); 		 			   
          }else if 					
          (qty <= 36){ 		 					   
          price = Number(qty * qty36); 		 			   
          }else if 					
          (qty <= 72){ 		 					   
          price = Number(qty * qty72); 		 			   
          }else if 					
          (qty <= 144){ 		 					   
          price = Number(qty * qty144); 		 			   
          }else if 					
          (qty <= 288){ 		 					   
          price = Number(qty * qty288); 		 			   
          }else if 					
          (qty <= 576){ 		 					   
          price = Number(qty * qty576); 		  			  
           }else if 					
          (qty <= 1008){ 		 					   
          price = Number(qty * qty1008); 		 			   
          }else if 					
          (qty <= 2016){ 		 					   
          price = qty * Number(qty2016); 				 				alert(document.prodform.price.value);	 								 							 			   } 		 				  		
          
          }

          Originally posted by acoder
          The user entered quantity, e.g.
          Code:
          function getCalc(){  	
          var quantity = parseInt(document.prodform.quantity.value);
          //...
          if (quantity <= 12) {
          price = quantity * qty12;
          } else if...

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            If it's decimals, then you need to use parseFloat.

            Since the hidden fields are being generated using server-side code, why not use similar code to generate the JavaScript variables, e.g.
            Code:
            var qty12 = <?php echo $val; ?>;
            There's also no need to use Number syntax. The two variables will be numbers which you can multiply together.

            Comment

            • maximillion511
              New Member
              • Jul 2008
              • 22

              #7
              OMG!!! this is getting really frustrating... here's the new code that also doesn't work. I understood what you meant about the parse float but since you said to use it on the user entered value, there's not a need for it as the user can only enter numbers that arent decimals..... IDK what is going on with this but i am really at a road block. any other ideas?????


              Code:
              function getCalc(){ 	 	
              var qty = parseInt(document.prodform.quantity.value); 	 	
              var qty12="<?php echo $row_Recordset1['qty12']; ?>"; 
              var qty24="<?php echo $row_Recordset2['qty24']; ?>"; 	
              var qty36="<?php echo $row_Recordset3['qty36']; ?>"; 
              var qty72="<?php echo $row_Recordset4['qty72']; ?>"; 
              var qty144="<?php echo $row_Recordset5['qty144']; ?>"; 	
              var qty288="<?php echo $row_Recordset6['qty288']; ?>"; 	
              var qty576="<?php echo $row_Recordset7['qty576']; ?>"; 	
              var qty1008="<?php echo $row_Recordset8['qty1008']; ?>"; 	
              var qty2016="<?php echo $row_Recordset9['qty2016']; ?>"; 	 	
              var price = document.prodform.price.value;  		
              
              if(qty >= 12){ 		 					   
                      price = (qty * qty12); 		 			   
              
                                            }else if 					
              (qty <= 24){ 		 					  
                      price = (qty * qty24); 		 			   
                                            }else if 					
              (qty <= 36){ 		 					   
                      price = (qty * qty36); 		 			   
                                           }else if 					
              (qty <= 72){ 		 					   
                      price = (qty * qty72); 		 			   
                                           }else if 					
              (qty <= 144){ 		 					   
                      price = (qty * qty144); 		 			   
                                           }else if 					
              (qty <= 288){ 		 					    
                      price = (qty * qty288); 		 			   
                                           }else if 					
              (qty <= 576){ 		 					   
                      price = (qty * qty576); 		  			   
                                           }else if 					
              (qty <= 1008){ 		 					   
                      price = (qty * qty1008); 		 			   
                                           }else if 					
              (qty <= 2016){ 		 					   
                      price = (qty * qty2016); 
              				 				alert(document.prodform.price.value);	 								 							 			   } 		 				  		
              
              }
              Originally posted by acoder
              If it's decimals, then you need to use parseFloat.

              Since the hidden fields are being generated using server-side code, why not use similar code to generate the JavaScript variables, e.g.
              Code:
              var qty12 = <?php echo $val; ?>;
              There's also no need to use Number syntax. The two variables will be numbers which you can multiply together.

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                qty12, qty24, etc. should be floats, not strings, e.g.
                Code:
                var qty12=<?php echo $row_Recordset1['qty12']; ?>; 
                var qty24=<?php echo $row_Recordset2['qty24']; ?>;
                // and so on...
                Why have you got qty >= 12? That would always multiply by the qty12 value. Surely, you mean (qty <= 12)?

                Comment

                • maximillion511
                  New Member
                  • Jul 2008
                  • 22

                  #9
                  acoder, have a question for ya... since i have those php variables being passed to hidden text boxes on the form, (and they actually show up) is there a way i can reference them instead of trying to call the php variable into the Javascriptfunct ion? i dont very much about php (still tryin to learn while i am doing this....) so i am trying to find the most streamlined method of making the client side do most of the work...


                  Originally posted by acoder
                  qty12, qty24, etc. should be floats, not strings, e.g.
                  Code:
                  var qty12=<?php echo $row_Recordset1['qty12']; ?>; 
                  var qty24=<?php echo $row_Recordset2['qty24']; ?>;
                  // and so on...
                  Why have you got qty >= 12? That would always multiply by the qty12 value. Surely, you mean (qty <= 12)?

                  Comment

                  • maximillion511
                    New Member
                    • Jul 2008
                    • 22

                    #10
                    ARGGHHHH!!!! this doesnt work either?!?!?!?!? what i am doing wrong here?????


                    Code:
                    function getCalc(){ 	 	
                    var qty = parseInt("document.prodform.quantity.value",10); 	
                    
                    alert(document.prodform.price.value); 	
                    
                    var qty12 = parseFloat(<?php echo $row_Recordset1['qty12']; ?>); 	
                    var qty24 = parseFloat(<?php echo $row_Recordset2['qty24']; ?>); 	
                    var qty36 = parseFloat(<?php echo $row_Recordset3['qty36']; ?>); 	
                    var qty72 = parseFloat(<?php echo $row_Recordset4['qty72']; ?>); 	
                    var qty144 = parseFloat(<?php echo $row_Recordset5['qty144']; ?>); 	
                    var qty288 = parseFloat(<?php echo $row_Recordset6['qty288']; ?>); 	
                    var qty576 = parseFloat(<?php echo $row_Recordset7['qty576']; ?>); 	
                    var qty1008 = parseFloat(<?php echo $row_Recordset8['qty1008']; ?>); 	
                    var qty2016 = parseFloat(<?php echo $row_Recordset9['qty2016']; ?>); 	 	
                    
                    var price = document.prodform.price.value; 	  		
                    if(qty <= 12){ 		 					   
                    price = (qty * qty12); 		 			   
                    }else if 					
                    (qty <= 24){ 		 					  
                    price = (qty * qty24); 		 			   
                    }else if 					
                    (qty <= 36){ 		 					   
                    price = (qty * qty36); 		 			   
                    }else if 					
                    (qty <= 72){ 		 					   
                    price = (qty * qty72); 		 			   
                    }else if 					
                    (qty <= 144){ 		 					   
                    price = (qty * qty144); 		 			  
                    }else if 					
                    (qty <= 288){ 		 					   
                    price = (qty * qty288); 		 			   
                    }else if 					
                    (qty <= 576){ 		 					   
                    price = (qty * qty576); 		  			   
                    }else if 					
                    (qty <= 1008){ 		 					   
                    price = (qty * qty1008); 		 			   
                    }else if 					
                    (qty <= 2016){ 		 					   
                    price = (qty * qty2016); 				 					 								 							 			   } 		 				  		
                    }

                    Comment

                    • acoder
                      Recognized Expert MVP
                      • Nov 2006
                      • 16032

                      #11
                      Originally posted by maximillion511
                      acoder, have a question for ya... since i have those php variables being passed to hidden text boxes on the form, (and they actually show up) is there a way i can reference them instead of trying to call the php variable into the Javascriptfunct ion?
                      Of course! As an example,
                      [code=javascript]var qty12 = parseFloat(docu ment.prodform.q ty12.value);[/code]

                      Comment

                      • acoder
                        Recognized Expert MVP
                        • Nov 2006
                        • 16032

                        #12
                        Originally posted by maximillion511
                        ARGGHHHH!!!! this doesnt work either?!?!?!?!? what i am doing wrong here?????
                        How are you calling getCalc()? What result were you expecting and what are you getting?

                        Comment

                        • maximillion511
                          New Member
                          • Jul 2008
                          • 22

                          #13
                          ok heres the source for the entire page. basically all my other functions work with the exception of the one to calculate quantity * price.

                          the code is supposed to do this:

                          user --> enters a quantity of 150-->getCalc says number is greater than 144 use the next one up = qty288--> cust(150) * qty288 --> spits out answer in text box for price. once that value is placed in the text box i need you use to later help add up the grand total.

                          price + setupchrg = grand total

                          price = function getCalc()
                          setup = function getSetup() ( this works in IE & FF) I took this out as it is 4 divs with drops downs that are just way too long to fill in here.

                          grandtot = function getgrandTotal() (this works in IE & FF)






                          Code:
                          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
                          <?php require_once('mySQlConn.php'); ?> 
                          <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")  {   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);    switch ($theType) {     case "text":       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";       break;         case "long":     case "int":       $theValue = ($theValue != "") ? intval($theValue) : "NULL";       break;     case "double":       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";       break;     case "date":       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";       break;     case "defined":       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;       break;   }   return $theValue; } }  mysql_select_db($database_mySQlConn, $mySQlConn); 
                          
                          $query_Recordset1 = "SELECT qty12 FROM price_breakdown  WHERE productID = '4401'"; $Recordset1 = mysql_query($query_Recordset1, $mySQlConn) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1);   mysql_select_db($database_mySQlConn, $mySQlConn); 
                          
                          $query_Recordset2 = "SELECT qty24 FROM price_breakdown WHERE productID='4401'"; $Recordset2 = mysql_query($query_Recordset2, $mySQlConn) or die(mysql_error()); $row_Recordset2 = mysql_fetch_assoc($Recordset2); $totalRows_Recordset2 = mysql_num_rows($Recordset2);  mysql_select_db($database_mySQlConn, $mySQlConn); 
                          
                          $query_Recordset3 = "SELECT qty36 FROM price_breakdown WHERE productID='4401'"; $Recordset3 = mysql_query($query_Recordset3, $mySQlConn) or die(mysql_error()); $row_Recordset3 = mysql_fetch_assoc($Recordset3); $totalRows_Recordset3 = mysql_num_rows($Recordset3);   
                          
                          $query_Recordset4 = "SELECT qty72 FROM price_breakdown  WHERE productID = '4401'"; $Recordset4 = mysql_query($query_Recordset4, $mySQlConn) or die(mysql_error()); $row_Recordset4 = mysql_fetch_assoc($Recordset4); $totalRows_Recordset4 = mysql_num_rows($Recordset4);  
                          
                          $query_Recordset5 = "SELECT qty144 FROM price_breakdown  WHERE productID = '4401'"; $Recordset5 = mysql_query($query_Recordset5, $mySQlConn) or die(mysql_error()); $row_Recordset5 = mysql_fetch_assoc($Recordset5); $totalRows_Recordset5 = mysql_num_rows($Recordset5);  
                          
                          $query_Recordset6 = "SELECT qty288 FROM price_breakdown  WHERE productID = '4401'"; $Recordset6 = mysql_query($query_Recordset6, $mySQlConn) or die(mysql_error()); $row_Recordset6 = mysql_fetch_assoc($Recordset6); $totalRows_Recordset6 = mysql_num_rows($Recordset6);  
                          
                          $query_Recordset7 = "SELECT qty576 FROM price_breakdown  WHERE productID = '4401'"; $Recordset7 = mysql_query($query_Recordset7, $mySQlConn) or die(mysql_error()); $row_Recordset7 = mysql_fetch_assoc($Recordset7); $totalRows_Recordset7 = mysql_num_rows($Recordset7);  
                          
                          $query_Recordset8 = "SELECT qty1008 FROM price_breakdown  WHERE productID = '4401'"; $Recordset8 = mysql_query($query_Recordset8, $mySQlConn) or die(mysql_error()); $row_Recordset8 = mysql_fetch_assoc($Recordset8); $totalRows_Recordset8 = mysql_num_rows($Recordset8);  
                          
                          $query_Recordset9 = "SELECT qty2016 FROM price_breakdown  WHERE productID = '4401'"; $Recordset9 = mysql_query($query_Recordset9, $mySQlConn) or die(mysql_error()); $row_Recordset9 = mysql_fetch_assoc($Recordset9); $totalRows_Recordset9 = mysql_num_rows($Recordset9); ?> 
                          
                            
                          <style type="text/css"> 
                          <!-- #apDiv1 { 	position:absolute; 	width:349px; 	height:225px; 	z-index:1; 	left: 456px; 	top: 86px; } 
                          
                          #apDiv2 { 	position:absolute; 	width:275px; 	height:229px; 	z-index:2; 	left: 12px; 	top: 80px; } 
                          
                          #apDiv3 { 	position:absolute; 	width:207px; 	height:236px; 	z-index:3; 	left: 16px; 	top: 81px; } --> 
                          
                          </style>  
                          
                          <style type="text/css"> 
                          <!-- #apDiv1 { 	position:absolute; 	width:200px; 	height:115px; 	z-index:1; 	left: 11px; 	top: 131px; 	visibility: hidden; }  
                          
                          #apDiv2 { 	position:absolute; 	width:200px; 	height:115px; 	z-index:1; 	left: 11px; 	top: 163px; 	visibility: hidden; } 
                          
                          #apDiv3 { 	position:absolute; 	width:200px; 	height:115px; 	z-index:1; 	left: 11px; 	top: 196px; 	visibility: hidden; } 
                          
                          #apDiv4 { 	position:absolute; 	width:200px; 	height:115px; 	z-index:1; 	left: 11px; 	top: 229px; 	visibility: hidden; } 
                          
                          #apDiv5 { 	position:absolute; 	width:302px; 	height:216px; 	z-index:2; 	left: 251px; 	top: 20px; } 
                          
                          #apDiv6 { 	position:absolute; 	width:316px; 	height:382px; 	z-index:3; 	left: 345px; 	top: 39px; }  --> 
                          
                          </style>  
                          
                          <script language ="javascript" type="text/javascript">  
                          
                          function getCalc(){ 	 	
                          var qty = parseInt(document.prodform.quantity.value); 	 	 	
                          var qty12 = parseFloat(<?php echo $row_Recordset1['qty12']; ?>); 	
                          var qty24 = parseFloat(<?php echo $row_Recordset2['qty24']; ?>); 	
                          var qty36 = parseFloat(<?php echo $row_Recordset3['qty36']; ?>); 	
                          var qty72 = parseFloat(<?php echo $row_Recordset4['qty72']; ?>); 	
                          var qty144 = parseFloat(<?php echo $row_Recordset5['qty144']; ?>); 	
                          var qty288 = parseFloat(<?php echo $row_Recordset6['qty288']; ?>); 	
                          var qty576 = parseFloat(<?php echo $row_Recordset7['qty576']; ?>); 	
                          var qty1008 = parseFloat(<?php echo $row_Recordset8['qty1008']; ?>); 	
                          var qty2016 = parseFloat(<?php echo $row_Recordset9['qty2016'];
                          ?>); 	 	 	 	 	
                          var price = document.prodform.price.value; 	 	  		
                          if(qty <= 12){ 		 					   
                          price = (qty * qty12); 					    		 			   
                          }else if{ 					
                          (qty <= 24) 		 					  
                          price = (qty * qty24); 		 			   
                          }else if { 					
                          (qty <= 36) 		 					   
                          price = (qty * qty36); 		 			   
                          }else if { 					
                          (qty <= 72) 		 					   
                          price = (qty * qty72); 		 			   
                          }else if { 					
                          (qty <= 144) 		 					   
                          price = (qty * qty144); 		 			   
                          }else if { 					
                          (qty <= 288) 		 					   
                          price = (qty * qty288); 		 			   
                          }else if { 					
                          (qty <= 576) 		 					   
                          price = (qty * qty576); 		  			   
                          }else if { 					
                          (qty <= 1008) 		 					   
                          price = (qty * qty1008); 		 			   
                          }else if { 					
                          (qty <= 2016) 		 					   
                          price = (qty*qty2016); 					    					    					    					    					 								 							 			   } 		 				  		}   	 	 
                          </script>   
                          
                          <script>  function getSetup()  { 
                          	var y = document.prodform.setupchrg.value; 	    
                          y = (document.prodform.numsel.value * document.prodform.setup49.value); 			document.prodform.setupchrg.value = y;  	  
                          }  
                          
                          function getgrandTotal()   { 	
                          
                          <!--  create var for prodform.price.value to be added here to complete price--> 	var x = document.prodform.price.value; 	
                          var y = document.prodform.setupchrg.value 	
                          var z = Number(x + y); 		 	
                          document.prodform.grandtotal.value = z; 	 		  
                          }  
                          </script>  
                          
                          <script language="javascript" type="text/javascript">  
                          
                          function dropnumb()  {  	
                          var numsel = document.getElementById('numsel'); 	 	
                          var maxind = Number(numsel.options[numsel.selectedIndex].value); 	 	 	
                          for(var x=1;x<=maxind;x++) 	 	 	
                          { 	 	  			
                          document.getElementById("apDiv"+x).style.visibility = "visible"; 	 	 	} 	 	 	
                          
                          for(var x=x;x<=5;x++) 	 	 	{ 	 	  			document.getElementById("apDiv"+x).style.visibility = "hidden";   		
                          }  
                          } 
                          </script> 
                          
                          </head>  
                          <body> 
                          <form action="#" method="get" name="prodform"> 
                          <input name="quantity" type="text" id="quantity" onfocus="getCalc()" /> <label>Qty.</label>  <br  /> <br  />  <label>  
                          
                          <select name="position" id="position">    
                          <option value="0">select</option>    
                          <option value="1">Front Side Only</option>    
                          <option value="2">Back Side Only</option>    
                          <option value="3">Both Sides</option>  
                          </select> Position</label>  
                          <br  /> <br  /> 
                          
                          <select id="numsel" name="numsel" onchange="dropnumb(0);">   
                          <option value="0">Blank</option>   
                          <option value="1">1</option>   
                          <option value="2">2</option>   
                          <option value="3">3</option>   
                          <option value="4">4</option> 
                          </select>   
                          
                          <br  />   
                          
                          <input name="setup49" type="hidden" id="setup" value="49.00" />      
                          <input name="qty12" type="hidden" id="qty12" value="<?php echo $row_Recordset1['qty12']; ?>" />   	
                          <br/>   
                          <input name="qty24" type="hidden" id="qty24"  value="<?php echo $row_Recordset2['qty24']; ?>"/> 	
                          <br /> 	
                          <input name="qty36" type="hidden" id="qty36" value="<?php echo $row_Recordset3['qty36']; ?>"/> 	
                          <br />   
                          <input name="qty72" type="hidden" id="qty72" value="<?php echo $row_Recordset4['qty72']; ?>"/> 	
                          <br />   
                          <input name="qty144" type="hidden" id="qty144" value="<?php echo $row_Recordset5['qty144']; ?>"/> 	
                          <br />   
                          <input name="qty288" type="hidden" id="qty288" value="<?php echo $row_Recordset6['qty288']; ?>"/> 	
                          <br />  
                           <input name="qty576" type="hidden" id="qty576" value="<?php echo $row_Recordset7['qty576']; ?>"/> 	
                          <br />   
                          <input name="qty1008" type="hidden" id="qty1008" value="<?php echo $row_Recordset8['qty1008']; ?>"/>     
                          <br />   
                          <input name="qty2016" type="hidden" id="qty2016" value="<?php echo $row_Recordset9['qty2016']; ?>"/> 
                          <?php mysql_free_result($Recordset1); 
                          mysql_free_result($Recordset2); 
                          mysql_free_result($Recordset3); 
                          mysql_free_result($Recordset4); 
                          mysql_free_result($Recordset5); 
                          mysql_free_result($Recordset6); 
                          mysql_free_result($Recordset7); 
                          mysql_free_result($Recordset8); 
                          mysql_free_result($Recordset9); ?>	 
                          <div id="apDiv9">   
                          <label> price</label>   <input name="price" type="text" id="price" onfocus="getCalc()"   />   
                          <br />   
                          <label> setup charge </label>   
                          <input name="setupchrg" type="text" id="setupchrg" onfocus="getSetup()"  />   <br  />   
                          <label>grand total   
                          <input name="grandtotal" type="text" id="grandtotal" onfocus="getgrandTotal()"  />   </label>   
                          <br /> 
                          </div> 
                          </form>  
                          </body> 
                          </html>

                          Comment

                          • acoder
                            Recognized Expert MVP
                            • Nov 2006
                            • 16032

                            #14
                            You've forgotten to set the value of the price field at the end of the function, i.e.
                            [code=javascript]document.prodfo rm.price.value = price;[/code]

                            Comment

                            • maximillion511
                              New Member
                              • Jul 2008
                              • 22

                              #15
                              you know? when i got home last night, i thought the same thing. when i got to work this morning, i had already placed it in the code. so idk.... but it still doesnt work either.


                              Originally posted by acoder
                              You've forgotten to set the value of the price field at the end of the function, i.e.
                              [code=javascript]document.prodfo rm.price.value = price;[/code]

                              Comment

                              Working...