下载所选项目的访问值而不发布数据[关闭]

I am new to php. Is there any way to access the value of selected item in a drop down menu without posting the data on the same form?

I'm not a php guy, but generally you would do this sort of thing with Javascript. In JQuery you'd use something like

$('#elementid option:selected').text();

Hope that's what you're looking for

JavaScript is the answer:

<script>
    function getDropDownInfo() {
        var objDropdown = document.getElementById('dropdown');
        alert(objDropdown.value);
    }
</script>

<form>
    <select name="dropdown" id="dropdown">
        <option value="one">one</option>
        <option value="two">two</option>
    </select>
</form>

<button onClick="getDropDownInfo();">get the data</button>

Since you are saying you need to access the value without posting it (means without communicating server), the task can be handled by client side scripting. You can use javascript for the instance.

Javascript:

<script lang='javascript'>
    var e = document.getElementById("test_id");
    var selectedValue = e.options[e.selectedIndex].value;
    alert(selectedValue);
</script>

HTML:

<select id="test_id">
    <option value="1">Item 1</option>
    <option value="2">Item 2</option>
    <option value="3" selected="selected">Item 3</option>
</select>

Check out in Fiddle