PHP を使用してテキストフィールド 'new_list_id' の値を取得できません。ここに私のコードがあります:
<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>
PHPを使用して、選択されたタグ「mymenu」の値を取得できますが、テキストフィールド「new_list_id」が存在し、SELECTタグが非表示の場合、その値を取得できません。
(問題)テキストフィールドで取得した値は、SELECTタグからの文字列「nothing」です。理由がわかりません。-私は新人プログラマーで、英語が下手で申し訳ありません..助けてくれてありがとう。
name 属性も使用していますが、同じ結果が得られます。私のphpコードもチェックしてください。ありがとう
if(isset($_REQUEST['sf_old']))
{ $sf=$_REQUEST['sf_old'];}
elseif(isset($_REQUEST['new_sf']))
{ $sf=$_REQUEST['new_sf'];}
else
{ $sf='';}
echo $sf;