Re: [PHP] Form Process Question
[email protected] (tedd)
| Newsgroups | php.general |
|---|---|
| Message-ID | <p06240801c65d8f9b74f2@[192.168.1.102]> |
At 11:03 AM -0400 6/16/09, Gary wrote: >I have a client that I have made some forms for. On one of the forms, their >customers are to registar for a class. The cost of the class is 195 per >person. She would like to have the people be able to have the total cost >calculated for them before they submit the form. (I already have the cost >calculated in the email and result page). > >I thought about creating a separate form within the original form page that >could calculate the cost, and process it to itself, I suppose I would need >to create a session so all the information in the first form is not wiped >out. > >Is there an easier way to do this or is there a way to create this >calculator that changes upon the input instead of clicking a calculate >button? > >Thanks > >Gary Gary: You could send everything to another form to show the totals, but that's not the most user friendly. The way I would do it is via javascript, like so: http://webbytedd.com/c/form-calc/ This populates the totals on the fly so that the customers see's the total as they pick things. Of course, you still must: 1) re-evaluate what the use submits on the server-side (i.e., never trust client-side for anything); 2) In case that the user does not allow javascript to work, then you have to plan for that and do it on the server-side anyway for graceful degradation. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com