Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 PHP Code: Create a drop down menu from an array list Jump to:  
Category: >> PHP Code >> Create a drop down menu from an array list Bookmark and Share

<< lastnext >>

Snippet Name: Create a drop down menu from an array list

Description: A short snippet that creates a drop down menu from an array.

Also see:
» Pre-populated List of Countries
» Array of all US states
» Search array elements for a substring
» Create a drop down menu from an array ...
» RMAN: List the most recent Level 0 bac...
» Get and set select lists with Javascri...
» DHTML Combo Box Dropdown
» Unset unkown array element
» TABLESPACE: List tablespaces, files, ...
» Randomize a list
» TIMESTAMP: List time zones
» List tables with more than 'X' rows
» List supported INIT.ORA parameters
» List security related profile informat...
» List all indexed columns for a given t...
» List analyzed tables with un-analyzed ...
» Parse RSS into array
» Build HTML select list from table
» Month, Day, Year dropdown boxes
» Select (dropdown) list generator
» Quickly sort associative arrays
» Recursively traverse array
» Combining three arrays into one
» Combining two arrays into one
» List files in directory
» Check if array is associative
» Get ordered list of near match items b...
» Make comma-separated list of strings
» Unique Array function
» Pick Randomly from Array

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: March 15th, 2009

<?PHP
 
// array contents array 1, value
$ddArray1 = ARRAY('Red','Green','Blue','Orange');
 
// array contents array 2, key => value
$ddArray2 = ARRAY('r'=>'Red','b'=>'Blue','g'=>'Green','o'=>'Orange');
 
// Values from array 1
PRINT '<select name="Words">';
 
// for each value of the array assign a variable name word
FOREACH($ddArray1 AS $word){
    PRINT '<option value="'.$word.'">'.$word.'</option>';
}
PRINT '</select>';
 
//Values from array 2
PRINT  '<select name="Words">';
 
// for each key of the array assign a variable name $let
// for each value of the array assign a variable name $word
 
FOREACH($ddArray2 AS $let=>$word){
    PRINT  '<option value="'.$let.'">'.$word.'</option>';
}
PRINT '</select>';
 
?> 


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 280 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?