PHP array to generate HTML drop-down list method, PHP array HTML dropdown
The example in this article describes how the PHP array generates HTML drop-down lists. Share to everyone for your reference. Specific as follows:
This code dynamically generates an HTML drop-down list (select) based on a well-defined PHP array.
<?php//array Contents Array 1:: value $myArray 1 = array (' Cat ', ' Mat ', ' Fat ', ' Hat '); Array Contents array 2:: Key = value $myArray 2 = Array (' c ' = = ' Cat ', ' m ' = = ' Mat ', ' f ' = = ' Fat ', ' h ' = ' Hat '); Values from array 1 echo ''; For each value of the array assign a variable name word foreach ($myArray 1 as $word) { echo ''. $word. '; } Echo ''; Values from array 2 echo ''; For each key of the array assign a variable name to//for each value of the array assign a variable name word foreach ($ MyArray2 as $let = $word) { echo ''. $word. '; } Echo '';?>
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/1035664.html www.bkjia.com true http://www.bkjia.com/PHPjc/1035664.html techarticle PHP array to generate HTML drop-down list of methods, PHP array HTML drop-down this article describes the PHP array to generate HTML drop-down list method. Share to everyone for your reference. As follows: This paragraph ...