Jump to content

Php Javascript Help


Revin

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/270278-php-javascript-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.