sd9sd Posted July 17, 2008 Share Posted July 17, 2008 Hi, I've got some html for a combobox: <td><form name="form1"><div align="center"> <select name="menu1" onChange="MM_jumpMenu('parent',this,0)"> <option>tag (23)</option> <option>tag (3)</option> <option>By Title</option> <option selected>Show All (92)</option> </select> </div> </form></td> I have a php file which echoes the html file to display it. I'm using this code for the php file to call itself: $path = empty($_SERVER['PATH_INFO'])?$_SERVER['PHP_SELF']:$_SERVER['PATH_INFO']; What I need is that when an option in the combobox is chosen, the option chosen should appear in the addressbar as a query string OR it should be available as a $_POST variable so that my php file should be able to capture it as either $_GET['id'] or $_POST['id'] Currently what's happening is: when an option is selected the php file calls itself, but the option chosen gets added to the address and it gets shown like www.site.com/optionChosen. I don't have a separate function to handle the MM_jumpMenu, but when I choose the option, how can I avoid it appearing in the addressbar and to capture it as a GET or POST? Quote Link to comment Share on other sites More sharing options...
sd9sd Posted July 17, 2008 Author Share Posted July 17, 2008 *boing!* Quote Link to comment Share on other sites More sharing options...
sd9sd Posted July 17, 2008 Author Share Posted July 17, 2008 Got it myself...the javascript has to be configured to send a query to php <script language="JavaScript" type="text/JavaScript"> <!-- function MM_jumpMenu(targ,selObj,restore){ //v3.0 var tagValue=selObj.options[selObj.selectedIndex].value; var stringCarryingQuery=tagValue.substring(0,tagValue.indexOf(" (")); var outputString=targ+".location='"+"a.php?tagSelection="+stringCarryingQuery+"'"; //document.write(outputString); eval(outputString); //if (restore) selObj.selectedIndex=0; } //--> </script> for <select name="tagSelection" onChange="MM_jumpMenu('self',this,0)">> Quote Link to comment 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.