Php > Complete Programs
Builds JavaScript that updates the contents of one selector based on another.
Builds JavaScript that updates the contents of one selector based on another. /* To simulate database connectivity, I'll fill some arrays */ $store_id = array( "1", "3", "4", "5", "6"); $store_state = array( "California", "California", "California", "Nevada", "Utah"); $store_city = array( "Los Angeles", "San Francisco", "Walnut Creek", "Las Vegas", "Salt Lake City"); $numStores = 5; $distinct_states = array( "California", "Nevada", "Utah"); /* create the javascript function the updates the city list */ echo "\n\n"; echo "
"; echo "
\n"; /* This is another place I'd put a query: */ /* select distinct State from store order by State */ echo "
Choose a State"; $RowCount = 0; while($RowCount < count($distinct_states)) { echo "
"; echo $distinct_states[$RowCount]; echo "\n"; $RowCount++; } echo "
\n"; /* Now we need to know how many cities are listed for the state with the most stores */ /* select count(*) as items from store group by State order by items desc */ $MaxItems = 3; echo "
\n"; $RowCount = 0; while($RowCount <= $MaxItems) { echo "
"; echo "Choose a Store Location\n"; $RowCount++; } echo "
\n"; echo "
"; echo "\n"; ?>
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