hello ,


i have products i create db
id,productname,price
------
1,cars,2000
2,renttv,20
3,blah,blah...


now i want make a checkbox for all this db

when you select the check box down give you total price

like if you select cars!

TOTAL PRICE: $2000

if you select 2 product like cars and renttv is come like this

TOTAL PRICE: $2020


all this in same page dont need to reload page


thank you

<html>
<script lang='javascript'>
var total=0;
function findtotal(flag,value1)
{
	if (flag)
	   total=total+parseInt(value1, 10);
	else
	   total=total-parseInt(value1, 10);
	document.frm.total.value=total;
}
</script>
<body>
<form name=frm>
Cars <input type=checkbox value=2000 onclick="javascript:findtotal(this.checked,this.value)"><br>
Rendtv <input type=checkbox value=20 onclick="javascript:findtotal(this.checked,this.value)"><br>
Blah<input type=checkbox value=2590 onclick="javascript:findtotal(this.checked,this.value)"><br>
<input type=text readonly name=total id=total >
</form>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.