Php > Complete Programs
Makes an dropDown (SELECT)
Makes an dropDown (SELECT) /* formDropDown - create an HTML
* vars: $name - the form variable NAME * $value - the SELECTED option * $labels - assoc. array, list of values=>labels * returns: string, HTML (i.e. for use in echo or print statement) */ function formDropDown($name,$value,$labels) { $html = "
\n"; $key = key($labels); while($key != "") { if ($key == $value) { $selected = "SELECTED"; } else { $selected = ""; } $html .= "
$labels[$key]\n"; next($labels); $key = key($labels); } $html .= "
\n"; return $html; } ?>
Php Codes
Algorithms
Arrays
Authentication
Calendar
Code Snippets
Programs
Content Manage
Contest Related
Cookies
Credit Cards
DBase Related
Databases
Date Time
Directories
E-Mail
Errors
File
File System
Forms
Handling
Graphics
HTML and PHP
Informix
Ingres
InterBase
LDAP
Look and Feel
Miscellaneous
MySQL
Other
PHP Classes
Searching
Navigation
Statistics
Strings
User Manage