The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> IF Calculations based on dropdown list
coryjacques
post Dec 13 2018, 02:10 PM
Post #1





Group: Members
Posts: 2
Joined: 13-December 18
Member No.: 26,771



Hello!

This is probably a little bit HTML and a lot a bit... something else (I'm new to HTML/Java/etc).

I have a code (below) to set up a two-question form. I'm looking to calculate excel-style based on the values a user selects. Here's the code:

CODE
<!DOCTYPE html>
<html>
<head>
    <title>How much will your plan cost?</title>
</head>
<body>
<table>
<tr></tr>
    <td><div align="Center"><h5>How much will your plan cost?</h5></td></tr>
    <Form action="processingscript.php" method="post">
    <tr>
    <td><p>How old are you?<select>
            <Option>Under 24</Option>
            <option>25-29</option>
            <option>30-34</option>
            <Option>35-39</option>
            <Option>40-44</option>
            <Option>45-49</option>
            <Option>50-54</option>
            <Option>55-59</option>
            <Option>60-64</option>
            <Option>65-69</option>

            </select></P></td></tr>
    <tr><td><p>How much of a benefit amount are you looking for?<Select>
        <Option> $10000</option>
<Option> 20000</option>
<Option> 30000</option>
<Option> 40000</option>
<Option> 50000</option>
<Option> 60000</option>
<Option> 70000</option>
<Option> 80000</option>
<Option> 90000</option>
<Option> 100000</option>
<Option> 110000</option>
<Option> 120000</option>
<Option> 130000</option>
<Option> 140000</option>
<Option> 150000</option>
<Option> 160000</option>
<Option> 170000</option>
<Option> 180000</option>
<Option> 190000</option>
<Option> 200000</option>
<Option> 210000</option>
<Option> 220000</option>
<Option> 230000</option>
<Option> 240000</option>
<Option> 250000</option>
<Option> 260000</option>
<Option> 270000</option>
<Option> 280000</option>
<Option> 290000</option>
<Option> 300000</option>
<Option> 310000</option>
<Option> 320000</option>
<Option> 330000</option>
<Option> 340000</option>
<Option> 350000</option>
</Select><br>
<tr><td><div align="center"><input type="submit" value="Calculate!"></div></tr></td>
    </Form>
</table>
</center>
</body>
</html>


Here's the table I'm trying to pull from - I'm essentially looking for something along the lines of "If the first box says 25-29, .04 will be multiplied by the value in the second box" for example.


Age Band | Multiple
<24 | $0.04
25-29 | $0.04
30-34 | $0.05
35-39 | $0.08
40-44 | $0.12
45-49 | $0.21
50-54 | $0.36
55-59 | $0.59
60-64 | $0.79
65-69 | $1.25


If it helps, in excel this would be something along the lines of (if box 1 is a1 and box 2 is a2): =if(or(a1="<24",a1="25-29"),a2*.04,if(a1="30-34",a2*.05, .....etc.

Any tips?

This post has been edited by coryjacques: Dec 13 2018, 02:17 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th April 2024 - 09:55 AM