的價值不能得到使用PHP我的文本框「new_list_id」的值。這裏是我的代碼:使用PHP我能得到我的選擇變量的值不能讓我的文本框
<select id="mymenu" size="1" name='sf_old' class='short_tf'>
<option > </option>
<option value="nothing">New Input</option>
<option value="101">101</option>
<option value="102">102</option>
</select>
<input type='text' class='short_tf' name='new_sf' id='new_list_id' style='display:none;'/>
<script type="text/javascript">
var selectmenu=document.getElementById("mymenu")
selectmenu.onchange=function(){
var index = selectmenu.selectedIndex;
if (index == '1'){
document.getElementById('new_list_id').style.display='inline';
document.getElementById('mymenu').style.display='none';
}
}
</script>
「的MyMenu」如果它是一個選擇,但我不能檢索如果我的文本框「new_list_id」的價值它是一個呈現並且SELECT標記被隱藏。
(問題) 爲我的文本框的值是字符串「什麼」,這是從我的SELECT標籤。無法弄清楚原因。 - 我是一名新手程序員,對於我可憐的英語也感到抱歉。非常感謝你的幫助。
我還使用name屬性,但它給了我同樣的結果。請檢查我的PHP代碼。謝謝
if(isset($_REQUEST['sf_old']))
{ $sf=$_REQUEST['sf_old'];}
elseif(isset($_REQUEST['new_sf']))
{ $sf=$_REQUEST['new_sf'];}
else
{ $sf='';}
echo $sf;
在PHP沒有PHP代碼標記問題。諷刺的 – Alexander
@亞歷山大請檢查我的PHP代碼。對不起,我應該已經包括它earlier.thanks – user1957878
呀,你有一個誤解,你可以檢查以下 – Alexander