Need Simple Help Fixing Form

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
soma56
Forum Newbie
Posts: 11
Joined: Fri Jul 10, 2009 12:12 pm

Need Simple Help Fixing Form

Post by soma56 »

I have a form I'm developing for a window/eaves cleaning company that has a unique request that I'd like to implement into their free quote for. Basically, what they want is the form to update the price of eavestrough cleaning when they select a specific size from a drop-down menu for their house. Here's a snippet of the code which should further explain what I'm trying to do:

Code: Select all

<td style="text-align:right;">What type of place do you have?</td>
        <td><select name="house" id="house">
          <option>Please Select</option>
          <option value="Bungalow">Bungalow</option>
          <option value="Semi Detached Bungalow">Semi Detached Bungalow</option>
          <option value="2 storey Semi Detached">2 storey Semi Detached</option>
          <option value="2 storey Detached">2 storey Detached</option>
          <option value="Side or Back Split">Side or Back Split</option>
         <option value="other">Commercial/Other</option>
        </select>
        </td>
      </tr>
      
      <td style="text-align:right;">
<input type="checkbox" name="asap" value="Yes">
      Would you like your eaves cleaned for $<!--ENTER DYNAMIC VALUE HERE--></td></tr>
Basically if Bungalow is chosen then the eaves cleaning price on the page would be updated to "X"
if Semi Detached Bungalow is chosen then the eaves cleaning price on the page would be updated to "Y"
if 2 storey Semi Detached is chosen then the eaves cleaning price on the page would be updated to "Z"
etc.,etc.

If anyone has any ideas on how I could accomplish this or could point me in the right dircetion then I would greatly appreciate it :)
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

Re: Need Simple Help Fixing Form

Post by cpetercarter »

This is a job for Javascript. Very briefly, you need to give the html element which contains your dynamic value a unique id. Then you need to write an "onchange" event handler for the select box, which will rewrite the dynamic value according to the house type selected.
soma56
Forum Newbie
Posts: 11
Joined: Fri Jul 10, 2009 12:12 pm

Re: Need Simple Help Fixing Form

Post by soma56 »

Thank you, I'll track down a javascript forum and see what they say
Post Reply