Revin Posted November 4, 2012 Share Posted November 4, 2012 Hi I know they are many topics on this but I can't seem to wrap my head around Java Script on a whole. I wanted to create a dynamic linked two select box. I saw a sample code on javascriptabout.com. I have adjusted the form to my values and placed a snippet below. <html> <head> <script> function setOptions(chosen) { var selbox = document.myform.LocatioTwo; selbox.options.length = 0; if (chosen == " ") { selbox.options[selbox.options.length] = new Option('Please select one of the options above first',' '); } if (chosen == "1") { selbox.options[selbox.options.length] = new Option('San Grande', 'Port of Spain- San Grande'); selbox.options[selbox.options.length] = new Option('Montrose','onetwo'); selbox.options[selbox.options.length] = new } } </script> </head> <body> <form name="myform"> <strong>Departure Location:</strong><select name="LocationOne" size="1" onchange="setOptions(document.myform.LocationOne.options [document.myform.LocationOne.selectedIndex].value);"> <option value=" " selected="selected"> </option> <option value="1">Port of Spain</option> </select><br> <br> <strong>Arrival Location:</strong><select name="LocatioTwo" size="1"> <option value=" " selected="selected">Please select one of the options above first</option> </select><br> <input type="button" name="go" value="Submit" onclick="alert(document.myform.LocatioTwo.options [document.myform.LocatioTwo.selectedIndex].value);"> </form> </body> </html> I need to know how to take those two locations from Javascript in to PHP. Any help on the matter will be greatly appreciated it.Thnakyou. Quote Link to comment https://forums.phpfreaks.com/topic/270278-php-javascript-help/ Share on other sites More sharing options...
codefossa Posted November 4, 2012 Share Posted November 4, 2012 What do you mean, "take it to PHP"? You want to post it? Check out Ajax. Quick example on the jQuery $.post() page. Or you can use jQuery and do it. Quote Link to comment https://forums.phpfreaks.com/topic/270278-php-javascript-help/#findComment-1390218 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.