Jump to content

Revin

New Members
  • Posts

    1
  • Joined

  • Last visited

Revin's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.