I have some php that creates input fields. Some of these fields need to be added, but they may not exhist because the user has not added them in. I want to be able to check to see if the field is there so I don’t keep getting errors.
Something like this:
var q0 = document.forms.formjunk.amount0.value;
var q1 = document.forms.formjunk.amount1.value;
var q2 = document.forms.formjunk.amount2.value;
var q3 = document.forms.formjunk.amount3.value;
var q4 = document.forms.formjunk.amount4.value;
var final = document.forms.orderform_16180.total.value;
final = q0 + q1 + q2 + q3 + q4;
Is there a way I can check to see if each amount is present before adding so I don’t get errors, or is there a better way to do this?