jquery - Inserting data using dynamic textbox -


i got problem inserting data mysql.

error message: notice: undefined index: total0, here's php code

if(isset($_post['submit'])){    $numquery = $_post['transaction'];    $itemtotz = "";    ($xquery = 0; $xquery < $numquery; $xquery++) {     $valpo_number = $_post['inpo_number'];    $valpo_date = $_post['inpo_date'];                       $valitem = $xquery+1;    $valquantity = $_post['quantity'.$xquery.''];    $valunit_price = $_post['unitprice'.$xquery.''];    $valtotal = $_post['total'.$xquery.''];    $valaprove_by = $_post['inaprove_by'];    $valprepared_by = $_post['inprepared_by'];    $valgrandtotal = $_post['grandtotal'];            if ($xquery == 0){       $itemtotz .= $valitem;       $valquantitytotz = $valquantity;       $valunit_pricetotz = $valunit_price;       $valtotaltotz = $valtotal;}       else {       $itemtotz .= "|".$valitem;       $valquantitytotz .= "|".$valquantity;       $valunit_pricetotz .= "|".$valunit_price;       $valtotaltotz .= "|".$valtotal;}} 

$query="insert purchasing_details(po_number, po_date, item, quantity, unit_price, total, aprove_by, prepared_by, grandtotal) values ('$valpo_number','$valpo_date','$itemtotz','$valquantitytotz','$valunit_pricetotz','$valtotaltotz','$valaprove_by','$valprepared_by','$valgrandtotal')"; mysql_query($query) ;

       echo "<script language=javascript>        alert('purchasing information submitted!');        </script>"; } 

here's javascript , variables, , computations

        function calculate(i) {         var myunitprice = document.getelementbyid('unitprice' + i).value;         var myquantity = document.getelementbyid('quantity' + i).value;         var result = document.getelementbyid('total' + i);         var myresult = myunitprice * myquantity;         result.value = myresult.tofixed(2);         totalvalue();}          function totalvalue() {         var totalvalue = 0;         $(document).find('input[name=total]').each(function(index, obj) {         if (isnan(parsefloat($(obj).val()))) $(obj).val(0)         totalvalue += parsefloat($(obj).val())})         $('#grandtotal').val(totalvalue.tofixed(2))}  var php = ''; $('#transaction').on('change', function () {     transaction = $(this).val();     html = '<table>';     (var = 0; < transaction; i++) {         html += '<tr><td><label>quantity</label><input type="text" name="quantity' + + '" id="quantity' + + '" oninput="calculate(' + + ')" /></td><td><label>unit price</label><input type="text" id="unitprice' + + '" name="unitprice' + + '" oninput="calculate(' + + ')" />' +             '</td><td><label>total</label><input type="text" name="total" id="total' + + '" /></td></tr>';     }     html += '</table><label>grand total </label><input type="text" id="grandtotal" name="grandtotal"/>' $('#kidsfields').html(html); $('.ui-page').trigger('create'); }); 

thank in advance.

the notice says didn't post total0 field in request @ all.

best thing here check javascript , possible developer tools (network tab) in chrome or via firebug in firefox see you're sending server.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -