Member 13134461
Как вставить значение тега span в базу данных
<html>
<head>
<link rel="stylesheet" href="css/smoothness/jquery-ui.css">
<script src="js/jquery-1.9.1.js"></script>
<script src="js/jquery-ui.js"></script>
<script>
function calc(obj){
var value =obj.value;
var cls = obj.className;
var texts = document.getElementsByClassName(cls);
var a = texts[0].value;
var b = texts[1].value;
a = parseFloat(a);
b= parseFloat(b);
a = isNaN(a) ? 0 : a;
b = isNaN(b) ? 0 : b;
var sum = a * b;
document.getElementsByClassName(cls + cls)[0].textContent = sum;
calTotal();
}
function calTotal(){
var spans = document.querySelectorAll('.aa,.bb,.cc,.dd,.ee,.ff,.gg,.hh,.ii,.jj,.kk,.ll,.mm,.nn,.oo,.pp,.qq,.rr')
var total = 0;
for(var i = 0; i <spans.length; i++){
var value = spans[i].textContent;
value = parseFloat(value);
value = isNaN(value)? 0:value;
total+= value;
}
document.getElementsByClassName('total')[0].textContent = total;
};
$(function() {
$( "#datepicker" ).datepicker({
changeMonth:true,
changeYear:true,
yearRange:"-100:+0",
dateFormat:"dd/mm/yy"
});
});
</script>
<style>
.aa, .bb, .cc, .dd, .ee,.ff,.gg,.hh,.ii,.jj,.kk,.ll,.mm,.nn,.oo,.pp,.qq,.rr, .total{
font-size: px;
font-weight: bold;
}
.headerb{
width:555px;
height:130px;
border:1px solid red;
}
.setup{
width:600px;
border: 1px dotted green;
float:center;
}
</style>
</head>
<body>
<div class="setup">
<div class="headerb">
<form method="post" action="insert.php" >
Invoice No:<input type="text" name="billno"/>
Date:<input name="date" class="datepicker" id="item34_date_1" required type="text"
data-hint="" value="<?php echo date('d/m/Y'); ?>" /><hr>
Name:<input type="text" name="cname"/>
Mobile No:<input type="text" name="cmob"/><br><hr>
Address:<input type="text" name="cadd"/>
DOB:<input type="text" name="txtdob" id="datepicker"></td></tr>
</div>
<table border="1px">
<tr>
<td>Product Discription</td>
<td>Unit Price</td>
<td>+</td>
<td>Quantity</td>
<td>=</td>
<td>Amount</td>
</tr>
<tr>
<td><input type="text" name="pro1" /></td>
<td><input class="a" type="text" name="up1" onkeyup="calc(this)"> </td>
<td>+</td>
<td><input class="a" type="text" name="quan1" onkeyup="calc(this)"> </td>
<td>=</td>
<td> <span class="aa" type="hidden" name="amt1"></span> </td>
</tr>
<tr>
<td><input type="text" name="pro2" /></td>
<td><input class="b" type="text" name="up2" onkeyup="calc(this)"> </td>
<td>+</td>
<td><input class="b" type="text" name="quan2" onkeyup="calc(this)"> </td>
<td>=</td>
<td> <span class="bb" name="amt2"></span> </td>
</tr>
<tr>
<td><input type="text" name="pro3" /></td>
<td><input class="c" type="text" name="up3" onkeyup="calc(this)"> </td>
<td>+</td>
<td><input class="c" type="text" name="quan3" onkeyup="calc(this)"> </td>
<td>=</td>
<td> <span class="cc" name="amt3"></span> </td>
</tr>
<tr>
<td><input type="text" name="pro4" /></td>
<td><input class="d" type="text" name="up4" onkeyup="calc(this)"> </td>
<td>+</td>
<td><input class="d" type="text" name="quan4" onkeyup="calc(this)"> </td>
<td>=</td>
<td> <span class="dd" name="amt4"></span> </td>
</tr>
<tr>
<td><input type="text" name="pro5" /></td>
<td><input class="e" type="text" name="up5" onkeyup="calc(this)"> </td>
<td>+</td>
<td><input class="e" type="text" name="quan5" onkeyup="calc(this)"> </td>
<td>=</td>
<td> <span class="ee" name="amt5"></span> </td>
</tr>
<tr>
<td><input type="text" name="pro6" /></td>
<td><input class="f" type="text" name="up6" onkeyup="calc(this)"> </td>
<td>+</td>
<td><input class="f" type="text" name="quan6" onkeyup="calc(this)"> </td>
<td>=</td>
<td> <span class="ff" name="amt6"></span> </td>
</tr>
<tr>
<td><input type="text" name="pro7" /></td>
<td><input class="g" type="text" name="up7" onkeyup="calc(this)"> </td>
<td>+</td>
<td><input class="g" type="text" name="quan7" onkeyup="calc(this)"> </td>
<td>=</td>
<td> <span class="gg" name="amt7"></span> </td>
</tr>
<tr>
<td><input type="text" name="pro8" /></td>
<td><input class="h" type="text" name="up8" onkeyup="calc(this)"> </td>
<td>+</td>
<td><input class="h" type="text" name="quan8" onkeyup="calc(this)"> </td>
<td>=</td>
<td> <span class="hh" name="amt8"></span> </td>
</tr>
<tr>
<td><input type="text" name="pro9" /></td>
<td><input class="i" type="text" name="up9" onkeyup="calc(this)"> </td>
<td>+</td>
<td><input class="i" type="text" name="quan9" onkeyup="calc(this)"> </td>
<td>=</td>
<td> <span class="ii" name="amt9"></span> </td>
</tr>
<tr>
<td><input type="text" name="pro10" /></td>
<td><input class="j" type="text" name="up10" onkeyup="calc(this)"> </td>
<td>+</td>
<td><input class="j" type="text" name="quan10" onkeyup="calc(this)"> </td>
<td>=</td>
<td> <span class="jj" name="amt10"></span> </td>
</tr>
<tr>
<td><input type="text" name="pro11" /></td>
<td><input class="k" type="text" name="up11" onkeyup="calc(this)"> </td>
<td>+</td>
<td><input class="k" type="text" name="quan11" onkeyup="calc(this)"> </td>
<td>=</td>
<td> <span class="kk" name="amt12" ></span> </td>
</tr>
<tr>
<td><input type="text" name="pro12" /></td>
<td><input class="l" type="text" name="up12" onkeyup="calc(this)"> </td>
<td>+</td>
<td><input class="l" type="text" name="quan12" onkeyup="calc(this)"> </td>
<td>=</td>
<td> <span class="ll" name="amt12"></span> </td>
</tr>
<tr>
<td><input type="text" name="pro13" /></td>
<td><input class="m" type="text" name="up13" onkeyup="calc(this)"> </td>
<td>+</td>
<td><input class="m" type="text" name="quan13" onkeyup="calc(this)"> </td>
<td>=</td>
<td> <span class="mm" name="amt13"></span> </td>
</tr>
<tr>
<td><input type="text" name="pro14" /></td>
<td><input class="n" type="text" name="up14" onkeyup="calc(this)"> </td>
<td>+</td>
<td><input class="n" type="text" name="quan14" onkeyup="calc(this)"> </td>
<td>=</td>
<td> <span class="nn" name="amt15"></span> </td>
</tr>
<tr>
<td><input type="text" name="pro15" /></td>
<td><input class="o" type="text" name="up15" onkeyup="calc(this)"> </td>
<td>+</td>
<td><input class="o" type="text" name="quan15" onkeyup="calc(this)"> </td>
<td>=</td>
<td> <span class="oo"></span> </td>
</tr>
<tr>
<td><input type="text" name="pro16" /></td>
<td><input class="p" type="text" name="up16" onkeyup="calc(this)"> </td>
<td>+</td>
<td><input