我有一個窗體有幾個文本區域,然後大約20個輸入字段。
的輸入字段被動態創建,使用一個循環,並從值在我的分貝創建(國家)
我的代碼是:
$options = '';
$country_code = '';
$query = $DB->query("SELECT country_code, country_id, IF(country_code = ".$country_code."', '', '') AS sel FROM exp_sme_countries WHERE site_id='".$this->settings['site_id']."' ORDER BY country_name ASC");
foreach ($query->result as $row)
{
$options .= '<label>' . 'Phrase for ' . $this->settings['countries'][$row['country_code']] . '</label>' . '<br />';
$options .= '<input style="width: 100%; height: 5%;" id="country_data" type="text" name="' . $row['country_id'] . '" />' . '<br /><br />';
$options .= '<input type="hidden" name="country_id" id="country_id" value="' . $row['country_id'] . '" />';
}
此輸出的例子,如:
input style="width: 100%; height: 5%;" id="country_data" type="text" name="68" />
input style="width: 100%; height: 5%;" id="country_data" type="text" name="28" />
現在我的問題是,我如何獲得這些輸入字段的值?
我看過輸出$ _POST,但這似乎返回我無法真正訪問的數據。
可以用任何方式訪問這些值嗎?
還是需要改變我做事的方式?
感謝
它看起來就像你輸出重複的html id一樣 - 不要這樣做。 – Skilldrick 2010-11-19 16:50:27