0

I'm new to PHP. i am trying to create some html code within a php function as below.


$str .="</div>
                <div class='cls_setpadding'>
                    <form method='get' action='homepage.php'>
                    <div class='cls_caller_options'>
                        <select name='test'>
                            <option value='allcaller'>".getResourceStrings('msg_allcaller',$lng)."</option>
                            <option value='specialcaller'>".getResourceStrings('msg_splcaller',$lng)."</option>
                        </select><br />
                    </div>
                    <div class='cls_msg_splcaller'>";
        $str .=      getResourceStrings('msg_spcallaer',$lng);          
        $str .="    </div>
                    <div style='padding-top:2%'></div>
                    <div class='cls_search_box'>
                    <input type='hidden' name='function' value='Buysuccess' />
                    <input type='hidden' name='vcode' value='".$vcode."' />";
                    if($testmsisdnheader != ""){
                        $msisdn_header = getheader();
                        $str .="<input type='hidden' name='".$msisdn_header."' value='".$msisdn."' />";
                    }

        $str .="    <input type='text' onkeydown='return ( event.ctrlKey || event.altKey 
                    || (47<event.keyCode && event.keyCode<58 && event.shiftKey==false) 
                    || (95<event.keyCode && event.keyCode<106)
                    || (event.keyCode==8) || (event.keyCode==9) 
                    || (event.keyCode>34 && event.keyCode<40) 
                    || (event.keyCode==46) )' name='cbsmsisdn' maxlength='12' disabled='true'/><br />
                    <div style='padding-top:1%'></div>
                    <input type='submit' value='Submit' /><br />
                    </div>
                </form>
            </div>";

Now I want to enable/disable the text box on the basis of value selected in drop down.

Here i like to put a condition where if the option value equals 'allcaller' the text box should be disabled which is actually happening. But I want to enable the same text box in case option value equals to 'specialcaller'.

I wasn't able to enable the text box on the basis of value selected in drop down.

Any help would be highly appreciated.

Thanks! Bobby.

4

1 回答 1

1

我有两个可能的解决方案给你。

  1. 正如您在评论中提到的那样,您不想使用 java 脚本,因为它是一个 WAP 门户,但如果不使用 javascript,他们没有其他方法可以做到这一点。我可以向您推荐一种方法,您可以要求用户提交他的下拉结果。根据该结果,您可以启用或禁用下一页上的文本框。

  2. 否则去javascript。

于 2012-08-09T10:22:39.323 回答