两个非常相似的<select>的,一个不保存到数据库吗?

时间:2019-02-27 20:27:29

标签: php html

HTML: (首先,在某些上下文中,我要在下面分享的片段位于一个循环内。这是循环,它基于索引文件中的数据): <?php             foreach($ field_data [$ i] as&$ field){                 $ field_name = $ field [0];                 $ table = $ field [1];                 $ table_field_name = $ field [2];                 $ field_type = $ field [3];                 $ iteration = $ field [4];                 $ clean =($ iteration> = 0?$ clean [$ table] [$ iteration] [$ field_name]:$ clean [$ table] [$ field_name]); ... 导致我出现问题的代码段:                                         <!-国家->                                     <?php} else if($ field [5] =='country'){?>                                                                          <?php}否则if($ field [5] =='citizenship_country'){?>                                                                          <?php}?> PHP索引文件:         $ tab [$ i] [15] = array(“ pd_citizenship_country_id”,“ c_pd”,“ c_pd [$ i] [pd_citizenship_country_id]”,“ select”,$ i,'citizenship_country');         $ tab [$ i] [16] = array(“ pd_dietary_restrictions”,“ c_pd”,“ c_pd [$ i] [pd_dietary_restrictions]”,“ textarea”,$ i); 选择在同一索引文件中定义的位置:         //国家         $ select ['countries_all'] = $ c_lookup-> getCountriesSelect(TRUE);         $ select ['countries_current'] = $ c_lookup-> getCountriesSelect(FALSE);         //国家         $ select ['citizenship_countries_all'] = $ c_lookup-> getCountriesSelect(TRUE);         $ select ['citizenship_countries_current'] = $ c_lookup-> getCountriesSelect(FALSE); 查找文件: / **  *获取国家选择  *  *返回国家/地区数组,以在国家/地区选择下拉列表中使用。  * / 函数getCountriesSelect($ param_all = FALSE,$ format ='HTML') {     $ sql;     $ result =假;     如果($ format =='')     {         $ format ='HTML';     }     $ sql =“ SELECT country_id,country_name,country_order             来自c_country             WHERE country_status_id ='A'“;             如果(!$ param_all)             {                 $ sql。=“和AND country_current_b ='Y'”;             }     $ sql。=“按国家/地区,国家名称排序”;     $ result = $ this-> c_db-> Execute($ sql);     如果($结果)     {         $ countries = array();         $ country_order ='';         while(!$ result-> EOF)         {             $ row = array();             $ row_html = array();             $ row = $ result-> FetchRow();             如果($ format =='HTML')             {                 $ row_html ['country_id'] = htmlentitIes($ row ['country_id'],ENT_QUOTES,$ this-> html_encoding);                 $ row_html ['country_name'] = htmlentitIes($ row ['country_name'],ENT_QUOTES,$ this-> html_encoding);                 $ row_html ['country_order'] = htmlentitIes($ row ['country_order'],ENT_QUOTES,$ this-> html_encoding);             }             其他             {                 $ row_html ['country_id'] = $ row ['country_id'];                 $ row_html ['country_name'] = $ row ['country_name'];                 $ row_html ['country_order'] = $ row ['country_order'];             }             $ countries [] = $ row_html;         }     }     其他     {         error_log(“ ERROR:getCountriesSelect:”。$ this-> c_db-> ErrorMsg()。“:SQL:$ sql”);         返回false;     }     返回$ countries; } 问题是,在数据库中,永远不会保存pd_citizenship_country_id,而会保存country_id。为什么?

0 个答案:

没有答案