I have a web page coded in PHP. This page is for posting a request for services. All services are stored in two separate tables along with prices.
As the user selects various services I want to fetch prices for the selected service and show it on per service basis and also a grand total of all services.
How can we do this?
I’m not totally sure what you’re going for, but you can’t actually fetch anything from MySQL with Javascript, but you can request a php script via xhr that will fetch the data, and then deal with it (add it up, etc.) via javascript.
If the number of services/prices isn’t huge, you could load it all in to the page in the first place then use javascript to add things up and leave the server alone.
There are several javascript frameworks and libraries that make this sort of thing quite easy (xhr), have you looked into those?
http://mootools.net
http://dojotoolkit.com
http://jquery.com
http://www.prototypejs.org