Create dynamic text field based on form drop down chosen

Discussion in 'HTML & Website Design' started by tracedef, Sep 29, 2009.

  1. #1
    The form below is a simple checkout form with a select box that allows users to choose the number of email accounts they want when they check out of our website and posts the user's drop down selection's value to the url string via get.

    The number of email accounts are 1, 3, and 6 email accounts. I'm trying to assign a dollar value to each option that will display in a text box (it says $TBA in example below) depending on the user's choice from select box.

    Example: User chooses 1 email box, so $5 displays where $TBA is or user chooses 6 email accounts and $10 displays where $TBA is.... we just want the $TBA to change to reflect the cost of the email accounts based on the user's chosen number of email accounts from drop down select box....

    Any feedback on how to accomplish this is appreciated!

    <form action="/accounts/cart.php" method="get">
    <table class="comparison pricing-email" border="0" cellspacing="1" cellpadding="0" width="100%">
    <tbody>
    <tr class="row1">
    <td class="col1">Choose # of EMAIL accounts:</td>
    <td>
    <select style="width: 60px; font-size: 17px;" name="a=add"> <option value="1">1</option> <option value="3">3</option> <option value="4">6</option> </select>
    </td>
    <td></td>
    </tr>
    <tr class="row1">
    <td class="col1">Per Month:</td>
    <td>$TBA</td>
    <td>
    <input type="image" src="/wp-content/themes/leadpress/images/sign-up.png" alt="Sign Up" /></input>
    </td>
    </tr>
    </tbody>
    </table>
    </form>
    Code (markup):
     
    tracedef, Sep 29, 2009 IP
  2. tguillea

    tguillea Active Member

    Messages:
    229
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    90
    #2
    Hahahaha by "assign dollar value" do you mean setting a variable?

    From your title I thought you wanted a drop down menu to change what a text box looks like, but the rest threw me off. Give me some more details and I'll whip up some code
     
    tguillea, Sep 29, 2009 IP
  3. tracedef

    tracedef Member

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #3
    Yeah, was struggling to describe what I am trying to accomplish. :) Yes, I would like to set a variable .... in the following example the goal is to have the dollar amount variable populate the $TBA space next to the "Per Month" row .... and assign dollar amount to each drop down value ..... so if "1" email account is chosen from select box $5 is shown in box... if "3" emails is shown $10 is shown in box...etc.....

    The actual values (hopefully I can populate these if given the starter code... )

    BTW, this is in WordPress environment....

    # email / Cost
    1 49
    3 59
    6 69
    9 79
    12 89
    15 99
    20 114
    25 129
    30 144
    35 159
    40 174
    45 189
    50 204
    55 219
    60 234
    65 249
    70 264
    75 279
     
    Last edited: Sep 29, 2009
    tracedef, Sep 29, 2009 IP
  4. tguillea

    tguillea Active Member

    Messages:
    229
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    90
    #4
    Isn't that your site? In which case it is already working properly?
     
    tguillea, Sep 29, 2009 IP
  5. tracedef

    tracedef Member

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #5
    It is, was just getting ready to post that it was up.... somebody sent me the code.... thank you so much for taking the time to look at this though!!!
     
    tracedef, Sep 29, 2009 IP