...

View Full Version : How do i pull a value from a javascript menu in a PHP form?



TheStig
09-06-2005, 08:01 AM
OK so i have setup my js 2 stage menu

select from 1st list is area

addOption("First-Select", "Select an Area", "", 1); //HEADER OPTION
addList("First-Select", "Aberdeen", "", "1");
addList("First-Select", "Aberdeenshire", "", "2");

From what is selected shows town in that are only

from

addOption("1", "Select a Town", "", 1); //HEADER OPTION
addList("1", "Ballater", "", "Ballater");
addList("1", "Balnagask", "", "Balnagask");
addList("1", "Banchory", "", "Banchory");
addList("1", "Bankhead", "", "Bankhead");
addList("1", "Bieldside", "", "Bieldside");

Now that all works fine but what i need to know now is how to tell the Form what has been selected

This is what i have now


<select nameselect name="PROPERTYLOCATION" style="width:180px;"></select><br><br><select nameselect name="PROPERTYTOWN" size="4" style="width:160px;"></select>

Were PROPERTYLOCATION is the 1st menu and PROPERTYTOWN is the second menu this works on the form as in it displai it on the page and i can select from eather menu just fine

What it is not doing is deting the value and writing it to SQL table so i need to know how or what i need to chang in this live of code please


<select nameselect name="PROPERTYLOCATION" style="width:180px;"></select><br><br><select nameselect name="PROPERTYTOWN" size="4" style="width:160px;"></select>

TheStig
09-06-2005, 08:51 AM
The thing i need is the select and options here is what i have and it is not adding the value to sql table it did before when i just had a php menu select form

I have added the PROPERTYTOWN to write to the sql table and i am getting no error on the page it is just not getting the value that has been selected from the 2 menus that are jarva cascade menu

here is the show menu on the for code


<select nameselect name="PROPERTYLOCATION" style="width:180px;"></select>
<option value="1">Please Select</option>
<br><br><select nameselect name="PROPERTYTOWN" size="4" style="width:160px;"></select>
<option value="0" selected>Any</option>

The Jarva menu works fine i just need the php for to pull the value selected on the php form page
Any help please as i need to get this finnished today please

NancyJ
09-06-2005, 09:30 AM
firstly you might want to change the title of this post to javascript rather than java (big difference) and secondly the answer can be found on a post someone made yesterday ;)

You need to use javascript to select the menu options whent he form submits



function selectAllOptions(obj){

for(var i=0;i<obj.options.length;i++)
{
obj.options[i].selected = true;
}
return true;
}


<form (..snip..) onsumbit="selectAllOptions(this.PROPERTYTOWN)">



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum