0

I need some help with PHP arrays.

I run a form, that sends this data:

$exposure = inputFilter($_POST['exposure']);

The value of EXPOSURE can either be: 1,2,3 or 4.

Each value (1,2,3 and 4) represents an exposure type. Example:

1 = micro
2 = mini
3 = standard
4 = extended

My question is how can I output this in an array?

3
  • What do you mean? What do you want to output? You don't know how to build the array? Commented Aug 11, 2011 at 12:11
  • 1
    -1 I can't understand the question and i think I'm not the only one Commented Aug 11, 2011 at 12:13
  • So your getting the numbers 1-4 from the form and now you need to turn the numbers into micro, mini, etc... how are you getting them from the form? Input box, select? Commented Aug 11, 2011 at 12:18

1 Answer 1

1
$exposure = inputFilter($_POST['exposure']);

$array = array(
    1 => 'micro',
    2 => 'mini',
    3 => 'standard',
    4 => 'extended'
);

echo $array[$exposure];

So when $exposure is 1, 'micro' is echoed, and so on.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.