dropdown value pass from javascript to php -


i have drop down box has 150 options want value of current option selected.i tried achieve using javascript , successful.now want want pass value php php knows option selected , on basis have change value of particular variable in php. how can achieve type of functionality.this code select option selected in drop down menu in javascrpit

    function myfun(){     var e=document.getelementbyname("location");     var struser = e.options[e.selectedindex].value; 

struser ocntain index value of dropdown option how can use value in php

this drop down code

<form action="final.php" method="post"> <select style="width: 200px;" name="location" onchange="myfun">   <option value="all">all</option>   <option value="noida sector 1">noida sector 1</option>   <option value="noida sector 2">noida sector 2</option>   <option value="noida sector 3">noida sector 3</option>   <option value="noida sector 4">noida sector 4</option>   <option value="noida sector 5">noida sector 5</option>   <option value="noida sector 6">noida sector 6</option>   <option value="noida sector 7">noida sector 7</option>   </select> 

once form has been submitted, able access value of has been selected in php accessing $_post['location']; contain contents of value attribute of submitted option.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -