473,320 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

how to store dynamic added table row values in php mysql database

Expand|Select|Wrap|Line Numbers
  1. <HTML> <HEAD> <style type="text/css">
  2.   #template {
  3.  display: none;   
  4. }
  5.  
  6. .add {
  7.    margin: 5px;
  8.    text-decoration: none;    
  9. }
  10.  
  11.   </style> <script type="text/jscript" src="http://example.com/New Folder/jquery-1.6.4.js"></script> <script type="text/javascript">
  12. var $k = jQuery.noConflict();
  13.  
  14. $k.fn.sum = function() {
  15.     var sum = 0;
  16.     $k(this).each(function() {
  17.         sum += parseFloat($k(this).val());
  18.     });
  19.  
  20.     return sum;
  21. }
  22.  
  23. $k(function() {
  24.     $k('input[name^=quantity], input[name^=unitprice]').live("keyup", function() {
  25.         var quantity = parseFloat($k(this).parent().find('input[name^=quantity]').val());
  26.         var unitprice = parseFloat($k(this).parent().find('input[name^=unitprice]').val());
  27.         $k(this).siblings('input[name^=linetotal]').val(quantity * unitprice);
  28.  
  29.         var sum = $k('input[name^=linetotal]').sum();
  30.  
  31.         $k('#subtotal').val(sum);
  32.         $k('#tax').val(Math.round(sum * 10 * 100) / 100);
  33.         $k('#total').val(Math.round((sum + Math.round(sum * 10 * 100) / 100) * 100) / 100);
  34.     });
  35.  
  36.     $k('.add').live('click', function() {
  37.         $k(this).closest('.item').after($k('#template').html());
  38.         $k('form .item').each( function(i) {
  39.         $k(this).find('input[name^=num]').val(i+1);
  40.         var q =$k('this').find('input[name^=num]').val();
  41.         alert(q);
  42.         });
  43.     });
  44. });
  45. </script> </HEAD> <body> <div id="template"> <div class="item"> <input name="num" value="1" size="5"> <a href="http://example.com/submit/g/#" class="add">+</a> <input name="desc" value="Description"> <input name="quantity" value="0"> <input name="unitprice" value="0"> <input name="linetotal" value="0"> </div> </div> <form id="item_form"> <div class="item" > <input name="num" value="1" size="5"> <a href="http://example.com/submit/g/#" class="add">+</a> <input name="desc" value="Description One"> <input name="quantity" value="0"> <input name="unitprice" value="0"> <input name="linetotal" value="0"> </div> <div class="item" > <input name="num" value="2" size="5"> <a href="http://example.com/submit/g/#" class="add">+</a> <input name="desc" value="Description Two"> <input name="quantity" value="0"> <input name="unitprice" value="0"> <input name="linetotal" value="0"> </div> <div class="line">
  46.         Subtotal: <input id="subtotal"> </div> </form> </body> </html>
Apr 8 '14 #1
1 2248
Dormilich
8,658 Expert Mod 8TB
I don’t see a table anywhere.
Apr 9 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: nagaraj530 | last post by:
hi friends, i want to store a video file in mysql database, if u r having any related code, please give me reply, i am waiting for that
4
by: grouchy | last post by:
hello all, not sure if i fully explained myself on an earlier post. All i really need to do is to store an xml file into mysql database. I have no idea how to do this, including any php code i...
9
by: barrathi | last post by:
how to insert image(like photo) in one particular table (mysql) help me.. thanks barrathi
2
by: secutos | last post by:
I have the option of storing data online as text files, or storing data online in a MySQL database. If the information is stored as a text file, all I have to do is a HttpWebRequest to the text file...
2
by: poopsy | last post by:
hello all, i am developing a web application for my final year project where i will be able to download and upload files(more specifically, it will be papers and articles, mostly pdf files) from the...
4
by: mainul05 | last post by:
hi, i m newbie php+mysql. in i have the following problem. i tried my best to solve it but could do it. please help me. i have a from where 3 fields are STATE, AREA and SUBRUB. AREA is connected...
1
ilya Kraft
by: ilya Kraft | last post by:
Hello, I'm currently developing social website which means that I'm going to use user images/avatars, photo albums etc. Is it a good idea to store all those images in MySQL database instead of...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.