PHP array and select list

后端 未结 4 1146
一整个雨季
一整个雨季 2020-12-16 20:47

I want to use php array for HTML select list. In this case it will be the list of countries but beside of country name that is listed in drop down list I need as a value of

4条回答
  •  情歌与酒
    2020-12-16 20:51

    If you are using this sort of array as shown by jakenoble I would use foreach().

    $wcr=array(
     "ANG" = > 'Angola',
     "ANB" = > 'Antigua & Barbuda',
     "ARM" = > 'Armenia', 
     "AUS" = > 'Austria',
     "AZB" = > 'Azerbaijan'
      );
    

    So the Foreach would look something like:

    foreach($wcr as $short_code => $descriptive) {
        ?>
        
        

提交回复
热议问题