HTML表单:如何在PHP

时间:2017-02-20 11:07:54

标签: php html

有人可以解释我如何在表单的标签中选择值并使用PHP而不是实际值参数吗?

e.g。

<option value="#NOT THIS#">#THIS!#</option>

由于

4 个答案:

答案 0 :(得分:0)

.footer-link>ul>li{
margin: 10px 4.2% 10px 0%;
font-family: gotham_book;
font-weight: bold;
color: #424242;
font-size: 14px;
text-decoration: none;
text-align: center;
}

如果这对您不起作用,请尝试以下方法:

<script>
    $("#yourdropdownid option:selected").text();
</script>

答案 1 :(得分:0)

<select  name="select" >
 <option value='1'>This 1</option>
 <option value='2'>this 2</option>
</select>​

和脚本

$(function(){    
    $("select[name='select']").change(function(){
      alert($(this).find('option:selected').text());       
    }); 
});

答案 2 :(得分:0)

试试这个。很简单。您可以选择id="someName"选项,并将其集中在您放置的字样上(#THIS!#&#34;)。

<script>
     $("#someID").change(function(element) {
                            var selectedValue = this.options[this.selectedIndex].text;
                            if (selectedValue === "#THIS!#") {
            // do something 
         }
        });
</script>

答案 3 :(得分:0)

嗯,你无法使用Php获取options标签内的值。提交表单时,它只将selectbox的value属性发送到服务器