| Welcome to WebmasterWorld Guest from 18.104.22.168 |
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
|Subscribe and Support WebmasterWorld|
|Assign multiple numeric values|
Non consecutive numbers
| 1:35 pm on Sep 7, 2007 (gmt 0)|
I have a form in one field of which users can choose one of several items. As an example let's say it is fruit they are choosing, apples, oranges, bananas, lemons etc.
I later need to assign a numeric value to their choice, but rather than doing multiple ifs
if($Fruit == "apples")
$FruitValue = 120;
elseif ($Fruit == "oranges")
$FruitValue = 80;
is there a way to do this in one go, without all the ifs?
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
© Webmaster World 1996-2013 all rights reserved