php 下拉菜单 多个值,PHP,而foreach下拉菜单在所有下拉菜单中都具有相同的选定值...
3個帶值的下拉菜單
$options1 = array( 1=>'= Equals', '≠ Does not Equal', '> Is greater than', '≥ Is greater than or equal to', '< Is less than', '≤ Is less than or equal', '? Contains', '? Does not contain');
$counter_maximum = 3;
while ($counter < $counter_maximum){
echo '
';
foreach ( $options1 as $i1=>$opt1 ) :
echo '
foreach ($entry_id_selector_topic as $entry_id_selector_i=>$entry_id_selector_topic_value ) :
echo (($i1 == $entry_id_selector_topic_value)? 'selected' : "");
endforeach;
echo '>';
echo $opt1 .'
';endforeach;
echo '';
$counter++;
}
用戶選擇一些值
用用戶選擇的值設置變量(數組)(此代碼位于所有其他代碼之上;位于頁面頂部)
$entry_id_selector_topic = $_POST['entry_id_selector'];
默認值(在頁面首次加載之后)是$options1或= Equals中的第一個值.用戶單擊提交按鈕后,我要記住用戶選擇的值.
但是,此代碼具有以下行為:
1)如果用戶僅在一個下拉菜單中更改/選擇值,則單擊“提交”后,所有下拉菜單中的值都會更改為用戶選擇的值.
2)如果用戶在多個下拉菜單中更改值,則所有菜單中的值都會更改/選擇為上一個更改了值的下拉菜單的值.
實驗時嘗試檢查$entry_id_selector_topic_value并在$entry_id_selector_topic之下= $_POST [‘entry_id_selector’];放置此代碼
foreach ($entry_id_selector_topic as $entry_id_selector_i=>$entry_id_selector_topic_value ) {
echo $entry_id_selector_topic_value .' $entry_id_selector_topic_value
';
}
這里$entry_id_selector_topic_value正是從每個下拉菜單中選擇的值.
需要進行哪些糾正(更改)操作來記住用戶在每個下拉菜單中選擇的值?
總結
以上是生活随笔為你收集整理的php 下拉菜单 多个值,PHP,而foreach下拉菜单在所有下拉菜单中都具有相同的选定值...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux开发板 pc 通讯_从51单片
- 下一篇: 卸载 windows_Windows 1