| Welcome to WebmasterWorld Guest from 184.108.40.206 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Pubcon Platinum Sponsor 2014|
|Assign multiple numeric values|
Non consecutive numbers
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.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved