How to change a buttons value based on user selections

Have some HTML code . The HTML consists of some textboxes such as name, company,email, address and a dropdown list containing 3 items ( a,b and c).

When the listbox has been released I am looking for JavaScript/php to check that all textboxes contain something, email is valid , and the 'value ' of the submit button at the bottom contains the listbox value multiplied by 10 dollars - for example button says
<buy at $30>.
any ideas much appreciated
Who is Participating?
mankowitzConnect With a Mentor Commented:
JQuery has a great validation plugin. See
Ray PaseurConnect With a Mentor Commented:
Agree with mankowitz -- jQuery rocks.

But that said, you will still have to validate all of the data fields all over again on the server side after the form is submitted.  Nice people will not cause you a problem, but hack-bots will copy your form, create a raw post string, bypass all of the javascript and inject toxic venom directly into your server-side script.  Your script needs to be able to withstand receiving garbage, viruses, etc. from the external input.

There is a mantra about it: Accept Only Known Good Values.  That does not mean "exclude bad values" -- the hackers can think of more bad values than you can exclude.  Instead it means test for data types and reasonability.  If you expect to receive an email address from the form, check that it is well-formed and routable.  If you expect an integer, test to see that it is, in fact, an integer. Etc, etc.  Most professionals would have a sanitize filter for every possible form input.

So go ahead and use jQuery validation - it's great tool for making your site attractive and easy to use.  Just don't mistake it for anything like any kind of security!

Best of luck with your project, ~Ray
plambkin1Author Commented:
Is Jquery difficult to learn - How many hours are required?

Thanks a million.
Ray PaseurConnect With a Mentor Commented:
Among my colleagues jQuery is not considered difficult to learn.  It's one of those lightbulbs that shines brightly, like when a PHP novice discovers the power of strtotime().  But my colleagues are professional programmers who do this stuff every day.  Their general consensus goes something like this, "jQuery implements the good parts of JavaScript and makes it easy to use."

Make a Google search for learn jquery and you're off to the races.  I can't really tell you how many hours are needed to learn it because I don't know your background.  If you understand the principles of computer science and you are already fluent in JavaScript and object-oriented design patterns it will come to you quickly, just a matter of practicing with the syntax.  In any case, good examples abound.  It is a very popular thing!
plambkin1Author Commented:
Great - thanks a million
All Courses

From novice to tech pro — start learning today.