I'm a beginner with Javascript, and am curently playing around with forms to see what can and can't be done. I'm a learn by doing kind of bloke!
I have a form which takes different numbers. It then POST's the information to a simple PHP script which simply echo's whichever value I want it to so I can play with the form to see what works and what doesn't.
What I'm trying to do is have the form add up two values when you hit the submit button, then POST the answer as one of the hidden form values. This is what I'm trying to do rather than add up the sent values in the receiving PHP file. I can do that already, I wont learn anything from doing that.
How I've tried going about this at the moment is instead of having the form submit whan hitting the submit button, have it run a function which adds up the values,
then submits the form. What actually happens though is that the webpage thinks about it for a bit, then just sits there and does nothing!
Here's the code I'm using. The form is called pl_pay.
In the header:
Code:
function payform() {
var total = first+amount;
document.forms.pl_pay.write('<input type="hidden" name="totalamm" value="'+total+'">');
document.forms.pl_pay.submit();
} Then on the submit button I've used a simple image with the href "javascript

ayform();" (obviously that's a : and a p in there, not a poky tongue smiley!)
So what have I done wrong here? Probably about a hundred things in 4 lines of code...
