I have a script to total the fields of a form, and it works great...but I am having trouble trying to figure out how to make it work when the name of the fields it is supposed to add up are php arrays.

Javascript :
function total(){ 
var vtemp=0 
for (var i=1;i<27;i++){// loop to get all inputs 
if(!isNaN(vtemp)) vresult+=vtemp// if value is a number - add it. 
document.all.total.value=vresult// change the last input...Result one 
Okay, so normally the field "ammount" would be "ammount1, ammount2, etc..", but on this paticular form I need it to be "ammount[id of the item], ammount[id of another item], etc..".

I am not sure how to make the javascript I have work with the php array...