Hi Guys,

Wasn't sure if I should post within PHP forum or Javascript so let me know if this is in the wrong place.

I have a form with a checkbox "labour" and button "view summary". The labour is pulled from my database, (php and mysql) as different labour is added to items depending on the item.

I have a javascript function for the checkbox that says if checkbox ticked add labour to total else don't add labour to total.

I need something so when I click on the "view summary" button, if checkbox is ticked add labour to next page and add labour to total on next page, else don't.

I'm not sure how I'd go about doing this as I don't know javascript well. Would I need to add something to the javscript I already have?
Do I pass the labour value as normal via php using $_POST as this is what I'm doing with other values?
Do I need some javascript on my summary.php which is where I want to pass the labour cost to?

Here is my code:
Code JavaScript:
var oldTotal=0;
function showlabour(total,labour) {
	if(document.getElementById('labour').checked == true){
		total = parseFloat(total) + labour;
		oldTotal = total;
		total = formatNumber(total,'2',',','.','','','','');
		document.getElementById('total').innerHTML = '<b>&pound;'+total+'</b>';
		total = parseFloat(oldTotal) - labour;
		oldTotal = total;
		total = formatNumber(total,'2',',','.','','','','');
		document.getElementById('total').innerHTML = '<b>&pound;'+total+'</b>';
function formatNumber(num,dec,thou,pnt,curr1,curr2,n1,n2) {
	var x = Math.round(num * Math.pow(10,dec));
	if (x >= 0) 
	var y = (''+Math.abs(x)).split('');
	var z = y.length - dec; 
	if (z<0) 
	for(var i = z; i < 0; i++) 
	y.splice(z, 0, pnt); 
	if(y[0] == pnt) 
	while (z > 3) 
	var r = curr1+n1+y.join('')+n2+curr2;
	return r;

Code PHP:
echo '<input id='labour' type='checkbox' onclick='showlabour($jsTotal , $totallabourcost );' />'
echo ', $totallabour, ';
echo '<input type="button" name="button1" value="update" onclick="return OnButton1();" />';

Also, I have 1 form with 2 buttons. an update and view summary so due to this the view summary button has some javascript that tells it to go to the next page.

Code JavaScript:
function OnButton2() { 
    document.form1.action = "summary.php" 
    return true; 

Any advice and help would be great.

Many thanks