php - Issues with if-statement -
i have list this:
<f:option1>0</f:option1> <f:option2>50 000</f:option2> <f:option3>100 000</f:option3> <f:option4>150 000</f:option4> <f:option5>200 000</f:option5> <f:option6>250 000</f:option6> <f:max_value>150 000</f:max_value> <f:min_value>0</f:min_value> <f:value1>1,50</f:value1> <f:value2>2,00</f:value2> <f:value3>3,00</f:value3> <f:value4>4,00</f:value4> <f:value5>5,00</f:value5> <f:value6>6,00</f:value6>
this list changes time, , want write if-statement correct value
$target_option = 50 000;//should me $target_value = 2,00 if (($option6 > 0) && ($option6 <= $target_value) && ($min_value <= $target_value) && ($max_value => $target_value)){ $target_value = $value6; }elseif (($option5 > 0) && ($option5 <= $target_value) && ($min_value <= $target_value) && ($max_value => $target_value)){ $target_value = $value5; }elseif (($option4 > 0) && ($option4 <= $target_value) && ($min_value <= $target_value) && ($max_value => $target_value)){ $target_value = $value4; }elseif (($option3 > 0) && ($option3 <= $target_value) && ($min_value <= $target_value) && ($max_value => $target_value)){ $target_value = $value3; }elseif (($option2 > 0) && ($option2 <= $target_value) && ($min_value <= $target_value) && ($max_value => $target_value)){ $target_value = $value2; }elseif (($option1 > 0) && ($option1 <= $target_value) && ($min_value <= $target_value) && ($max_value => $target_value)){ $target_value = $value1; }
anyone see im doing wrong, or if there better way of doing this?
edit:
se complete code here: http://pastebin.com/5pfh4jzf
edit 2
found error on statement.
there 2 errors
1
$target_option = 50 000;
shoud be
$target_option = 50000; // no spaces
2
the last statement of each of them
($max_value => $target_value)
should be
($max_value >= $target_value)
use code editors avoid kind of errors
Comments
Post a Comment