toamanz Posted June 5, 2008 Share Posted June 5, 2008 Guys, I am having a tough time getting the value of this drop down box. Here is the drop down code i got.. <select size="1" name="DDList" id="DDList" onChange="xajax_changeScrapAccess(this.options[this.options.selectedIndex].value)"> {$DD_options} Where DD_options is as below <option selected>friends</option> <option>friends of friends</option> <option>everyone</option> Now here is the function function xajax_changeScrapAccess($arg) { $access_mode = $arg['scrpr']; if($access_mode=="everyone") { $access_mode = "EVERY"; } } I just want to get the value in $access_mode liek if the user select private, i should get the value private in access_mode variable? Help will be much appreciated Thanks Aman Quote Link to comment https://forums.phpfreaks.com/topic/108900-to-get-the-value-of-the-drop-down-box-in-function/ Share on other sites More sharing options...
discomatt Posted June 5, 2008 Share Posted June 5, 2008 PHP wont see any form variables unless a form is posted. You can do this in the background using JavaScript... You seem to be confusing client-side and server-side scripting. Quote Link to comment https://forums.phpfreaks.com/topic/108900-to-get-the-value-of-the-drop-down-box-in-function/#findComment-558641 Share on other sites More sharing options...
hansford Posted June 5, 2008 Share Posted June 5, 2008 this --> $access_mode = $arg['scrpr']; should just be --> $access_mode = $arg; Quote Link to comment https://forums.phpfreaks.com/topic/108900-to-get-the-value-of-the-drop-down-box-in-function/#findComment-558656 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.