Calculation based on Values Selected

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shamilwebdev
Forum Newbie
Posts: 5
Joined: Thu Oct 03, 2013 4:30 am

Calculation based on Values Selected

Post by shamilwebdev »

Hi Friend,

I am developing php page, I am struck on one part :banghead:

I have 3 dropdown menus.

1) Room Type
2) No of Person
3) Extra Person
and a Textbox

Now my Issue is, When I select Room type as Executive the amount should be shown on textbox and select "premium" relevant amount should be shown.
when I add Extra Person, Rs 500 should be added in textbox.

Thanks
shamil
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Calculation based on Values Selected

Post by Celauran »

What have you written so far? What isn't working? What errors are you encountering?
shamilwebdev
Forum Newbie
Posts: 5
Joined: Thu Oct 03, 2013 4:30 am

Re: Calculation based on Values Selected

Post by shamilwebdev »

I have not writtern anything till now. I dont no how to write it
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Calculation based on Values Selected

Post by Christopher »

You need to use Javascript for this. Write event handlers for when the dropdown menus change. I would recommend a Javascript library like jQuery.
(#10850)
shamilwebdev
Forum Newbie
Posts: 5
Joined: Thu Oct 03, 2013 4:30 am

Re: Calculation based on Values Selected

Post by shamilwebdev »

Thanks, Can you give me any sample Link or Code for this, Hw to do it in Javascript
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Calculation based on Values Selected

Post by Christopher »

Search for an example of a jQuery onChange handler for form elements. You should find lots of examples.
(#10850)
shamilwebdev
Forum Newbie
Posts: 5
Joined: Thu Oct 03, 2013 4:30 am

Re: Calculation based on Values Selected

Post by shamilwebdev »

Thank You.

Got the solution. Now I want to Post the TextBox "Amount" to another Textbox in the same page.
I used the post method but getting an error.

estSSLtest.php on line 434 Call Stack #TimeMemoryFunctionLocation 10.0006425440{main}( )..\testSSLtest.php:0 "/>
Post Reply