posted 24 years ago But then what is calling your function? Is there a reason you are not using plain javascript with the HTML form? Why not check the value of "quantity" before you process the page? You can use onSubmit or onClick with your form to check the value before submission.
As far as refreshing the page, if your page has already been submitted and what you are looking at is the results after returning from form processing, you are always going to resubmit the form on refresh. You'd have to use your back button to get back to the original form. Does that make sense or sound like babbling?
I hope this helps.