I'm trying to make a simple shopping cart. In my shop page, there are only 6 product. Visitor can type how many item each they want to buy. After that the page redirect to ShareIt to be process.
What I want to ask is :
- Is there anyway to validate input only numeric ?
- How can I check the form, so only valid value will be send to ShareIt.
The link would be like : http://shareit1.*************/cart.html?product[A1]=quantity+product[A2]=quantity.....
So if the quantity value 0 (or characters), it will not send to ShareIt.
Thanks for any help.
Sorry, there is mistype.
The isNaN() will tell you if a value is a number or not; it would be used as such:
if (isNaN(quantity) ) alert("you must enter a number.");
If you would like to see how you can validate a form for all types of form elements, see the "Validating Forms" script/tutorial at my site
I do my form validation using PHP _after_ the user has submitted the form.