Need Multiple Correct Answers In String - The OR Command?

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:

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.

<?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? :frowning:

I do not know what your $variable1, … $variable5 means, but you need to compare answer with 2 string values like this:
[php]if($assets == ‘$0 - $15K’ or $assets == ‘$15K - $50K’){
echo “You should consider getting $100000K in coverage”;
}[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service