How to display answers based on drop down selection?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • So Confused

    #1

    How to display answers based on drop down selection?

    I have a drop down selection menu on an HTML form.

    I want to display 1 answer, for a few selection options.... and another answer for the rest of the options.

    Example code is below:

    Code:
    How Much Are You Worth In Total Assets (Savings, Equity, Stocks, 401K, Car, Home, Anything of Value, etc...)?
      <select name="assets">
        <option value="$0 - $15K">$0 - $15K</option>
        <option value="$15K - $50K">$15K - $50K</option>
        <option value="$50K - $100K">$50K - $100K</option>
        <option value="$100K - $200K">$100K - $200K</option>
        <option value="$200K - $400K">$200K - $400K</option>
        <option value="$400K - $700K">$400K - $700K</option>
        <option value="$700K - $1M">$700K - $1M</option>
        <option value="$1M+">$1M+</option>
      </select>
    Those would be the choices. Now here is my PHP code... I cannot get it work.

    Code:
    <?php
    if ($answer=="$variable1, $variable2, $variable3, $variable4, $variable5, ($assets == $0 - $15K || $assets == $15K - $50K)")
    echo "You should consider getting $100000K in coverage";
    
    etc..etc...
    I want to display the answer here, if they picked either of those 2 asset options (in the string). What am I doing wrong?
Working...