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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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