Reputation: 2771
Here's my code for the options page:
array(
"name" => "Background Image",
"desc" => "Select your background image.",
"id" => $shortname."_blog_background",
"type" => "select",
"options" => array("Light Wood", "Dark Wood"),
"std" => ""
),
The select will show and will return the values inside the array. Is there a way to show "Light Wood", but to return "light-wood.png" ? I tried this:
"options" => array(
array('name' => 'Light Wood', 'value' => 'light-wood.png'),
array('name' => 'Dark Wood', 'value' => 'dark-wood.pn')
),
but it returns "Array".
Upvotes: 0
Views: 618
Reputation: 2282
Is this what you are trying to do?
<select name="">
<option value="light-wood.png">Light Wood</option>
<option value="dark-wood.png">Dark Wood</option>
</select>
Then the code should be:
<select>
<?php foreach($options as $option) echo "<option value=\"{$option[value]}\">{$option[name]}</option>"; ?>
</select>
Or, is there like a form generator that will create the HTML automatically? Then you can try (but I'm just guessing):
"options" => array(
array('Light Wood'=> 'light-wood.png'),
array('Dark Wood' => 'dark-wood.png'),
),
Or interchange 'light-wood.png' => 'Light Wood'.
Upvotes: 2