hi, in my shopping cart we have a phone orders and when user tells products we will click on that product and calculate the total and insert in to database
my code is like
<table width="100%" border="0" align="left" cellpadding="3" cellspacing="1" class="borent">
<? $s=-1;
while ($prow = mysql_fetch_assoc($pres)) {
$s++;
$item[$s]=$prow['p_id'];
$p123[$s]=$prow['p_price'];
// discount calculation
//
?>
<tr>
<td width="38%" align="left" valign="top"><span class="bulkname"> <?php echo $prow['p_name'];?></span></td>
<td width="18%" align="center" valign="top">Rs.<span class="red"><?php echo number_format($prow['p_price'],2);?> </span>Per <? echo getdata("tbl_measurement","name","id='".$prow['p_measurement']."'");?></td>
<td width="15%" align="center" valign="top">
<input name="PROD_<? echo $s;?>" type="text" class="box" id="PROD_<? echo $s;?>" onKeyUp="calculatetotal()" value="1" size="1"/>
<input name="price<? echo $s;?>" id="price<? echo $s;?>" type="hidden" size="1" value="<?php echo $prow['p_price'];?>">
<input name="ids[]" id="ids[]" type="hidden" size="1" value="<?php echo $prow['p_id'];?>">
<? echo getdata("tbl_measurement","name","id='".$prow['p_measurement']."'");?></td>
<td width="9%" align="center" valign="top"><label>
<input type="checkbox" name="chek<? echo $s;?>" id="chek<? echo $s;?>" value="1" onClick="calculatetotal()" /></label>
<input name="order<?=$s;?>" type="hidden" value="" size="2"></td>
<td width="20%" align="center" valign="top"><div id="subprice<? echo $s;?>" class="text5"></div></td>
<? }?>
</tr>
</table>
the javascript function is
function calculatetotal(){
var tot=0;
for (var i=0; i <=<?=$s;?>;i++) {
if (OnlyNumbers(document.getElementById("PROD_"+i))==0){return false;}
if(document.getElementById("chek"+i).checked==true){
if(document.getElementById("PROD_"+i).value<=0){
alert("Minimum Quantity To Be Entered is 1");
document.getElementById("PROD_"+i).value=1
document.getElementById("PROD_"+i).focus();
document.getElementById("PROD_"+i).select();
document.getElementById("chek"+i).checked==false
return false;
}
subtot=document.getElementById("price"+i).value*document.getElementById("PROD_"+i).value
document.getElementById("subprice"+i).innerHTML=subtot
tot=tot+subtot;
}else{
document.getElementById("subprice"+i).innerHTML="";
}
}
document.getElementById("TOTAL").innerHTML=tot
}
now i want is when onclick event takes place in order hidden variable the should be increment by 1
help me
thanks in advance