I need an expert who can help me in solving this selectbox problem.

Hello all experts,
I have got this 2 options for the user, here is what is said to him but i want to simplify this
for the user more than that :
if your business is located in the following area(Group A):
Colorado, Connecticut, Delaware, Maine, Maryland, Massachusetts, Montana, New Hampshire, North Dakota
Pennsylvania, Rhode Island, South Dakota, Utah, Vermont, Virginia, Washington, D.C. West Virginia and Wyoming

Please send your package to: Philadelphia
 
and if it is located in the following regions:

Alabama, Alaska, Arizona, Arkansas, California, Florida, Georgia, Guam, Hawaii, Idaho, Illinois, Indiana, Iowa,
Kansas, Kentucky, Louisiana, Michigan, Minnesota, Mississippi, Missouri, Nebraska, Nevada, New Jersey, New
York, New Mexico, North Carolina, Ohio, Oklahoma, Oregon, Puerto Rico, South Carolina, Tennessee, Texas, Virgin
Islands, Washington and Wisconsin

Please send your package to: San Francisco

so i want this to be represtented in this way :
the user will have a selectbox with all the regions and when he selects any region
the address that this package is supposed to be sent to, should be filled in another field automatically.

So here is what is in  my mind its just the logic:

if the user selects any region in group A then
FIELD Address.value = Philadelphia
else
FIELD Address.value = San Francisco

would someone help my in this code?if someone have a better solution for this ,that will be greate.
 Thanks in advance.
MelfekyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AgentSmith007Commented:
How does THIS work out for ya!?

<%
set rs=Server.CreateObject("ADODB.recordset")
'If you don't have SQL Server installed, you'll have to enter the VALUE of the DataTypeEnum, for example, below, 200 is a string, 3 is an integer...complete list can be found here: http://www.devguru.com/Technologies/ado/quickref/recordset_fieldscollection.html
rs.Fields.Append "Region",200,100
rs.Fields.Append "Address", 200, 100
rs.open

Address1 = "123 Sesame Street, Albuquerque, NM"
Address2 = "456 Elm Street, Las Vegas, NV"

sub AddItem(Region,Address)
      rs.AddNew
      rs("Region") = Region
      rs("Address") = Address
      rs.Update
      rs.movelast
end sub
'Adding a row (You can prolly simplifily this with a function)
AddItem "Colorado",Address1
AddItem "Connecticut",Address1
AddItem "Delaware",Address1
AddItem "Maine",Address1
AddItem "Maryland",Address1
AddItem "Massachusetts",Address1
AddItem "Montana",Address1
AddItem "New Hampshire",Address1
AddItem "North Dakota",Address1
AddItem "Pennsylvania",Address1
AddItem "Rhode Island",Address1
AddItem "South Dakota",Address1
AddItem "Utah",Address1
AddItem "Vermont",Address1
AddItem "Virginia",Address1
AddItem "Washington, D.C.",Address1
AddItem "West Virginia",Address1
AddItem "Wyoming",Address1

AddItem "Alabama",Address2
AddItem "Alaska",Address2
AddItem "Arizona",Address2
AddItem "Arkansas",Address2
AddItem "California",Address2
AddItem "Florida",Address2
AddItem "Georgia",Address2
AddItem "Guam",Address2
AddItem "Hawaii",Address2
AddItem "Idaho",Address2
AddItem "Illinois",Address2
AddItem "Indiana",Address2
AddItem "Iowa",Address2
AddItem "Kansas",Address2
AddItem "Kentucky",Address2
AddItem "Louisiana",Address2
AddItem "Michigan",Address2
AddItem "Minnesota",Address2
AddItem "Mississippi",Address2
AddItem "Missouri",Address2
AddItem "Nebraska",Address2
AddItem "Nevada",Address2
AddItem "New Jersey",Address2
AddItem "New York",Address2
AddItem "New Mexico",Address2
AddItem "North Carolina",Address2
AddItem "Ohio",Address2
AddItem "Oklahoma",Address2
AddItem "Oregon",Address2
AddItem "Puerto Rico",Address2
AddItem "South Carolina",Address2
AddItem "Tennessee",Address2
AddItem "Texas",Address2
AddItem "Virgin",Address2
AddItem "Islands",Address2
AddItem "Washington",Address2
AddItem "Wisconsin",Address2

rs.movefirst
rs.sort="Region"
%>
<script>
function fShowAddress(){
      oItem = document.forms.frmRegions.strRegion;
      destination = oItem.options[oItem.selectedIndex].value;
      document.forms.frmRegions.strAddress.value=destination;
}
</script>
<form name="frmRegions">
<select name="strRegion" onChange="fShowAddress()">
<option value="" selected>Select your region</option>
<%
while not rs.EOF
%>
      <option value="<%= rs("Address") %>"><%= rs("Region") %></option>
<%
      rs.movenext
wend
%>
</select>
<br>
Address:<br>
<input type="text" name="strAddress">
</form>
0
QuazzMotoCommented:
I think you're going about it the right way.
Just put an event on that drop down list and call a javascript function. such as <dropdownlist name="list1" onClick = "fillField();">
and whatever else.  Then put this in a script block.

function fillField()
{
   if(document.form1.ddRegion.value == "whatever")
      docuement.form1.txtSendTo.value = "San Fran";
   else if(document.form1.ddRegion.value == "whateverelse")
       document.form1.txtSendTo.value = "Florida";

}

Yours will be a bit more complicated, but that is the jist of it.  You already have the logic though.
0
AgentSmith007Commented:
Ya, I was thinking javascipt at first, but since this was in the ASP channel I went the ASP route
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

AgentSmith007Commented:
Not to mention this way will automatically fill out and sort all the Region names for you.
0
MelfekyAuthor Commented:
Hello AgentSmith,
i have tried ur code and it works finr but when i added the actual address which is something like this:
Address1 = "Small Business Administration
Division of Program Certification and Eligibility
Robert N.C. Nix Federal Building
900 Market Street, 5th Floor
Philadelphia, PA 19107"

Address2 = "Small Business Administration
Division of Program Certification and Eligibility
455 Market Street, 6th Floor
San Francisco, CA 94105"

I got an error:
Error Type:
Microsoft VBScript compilation (0x800A0409)
Unterminated string constant
/pdf1/address.asp, line 8, column 41
Address1 = "Small Business Administration
0
AgentSmith007Commented:
This option will allow you to put line breaks in your address:

<%
set rs=Server.CreateObject("ADODB.recordset")
'If you don't have SQL Server installed, you'll have to enter the VALUE of the DataTypeEnum, for example, below, 200 is a string, 3 is an integer...complete list can be found here: http://www.devguru.com/Technologies/ado/quickref/recordset_fieldscollection.html
rs.Fields.Append "Region",200,100
rs.Fields.Append "Address", 200, 100
rs.open

Address1 = "123 Sesame Street" & chr(10) & "Albuquerque, NM"
Address2 = "456 Elm Street" & chr(10) & "Las Vegas, NV"

sub AddItem(Region,Address)
      rs.AddNew
      rs("Region") = Region
      rs("Address") = Address
      rs.Update
      rs.movelast
end sub
'Adding a row (You can prolly simplifily this with a function)
AddItem "Colorado",Address1
AddItem "Connecticut",Address1
AddItem "Delaware",Address1
AddItem "Maine",Address1
AddItem "Maryland",Address1
AddItem "Massachusetts",Address1
AddItem "Montana",Address1
AddItem "New Hampshire",Address1
AddItem "North Dakota",Address1
AddItem "Pennsylvania",Address1
AddItem "Rhode Island",Address1
AddItem "South Dakota",Address1
AddItem "Utah",Address1
AddItem "Vermont",Address1
AddItem "Virginia",Address1
AddItem "Washington, D.C.",Address1
AddItem "West Virginia",Address1
AddItem "Wyoming",Address1

AddItem "Alabama",Address2
AddItem "Alaska",Address2
AddItem "Arizona",Address2
AddItem "Arkansas",Address2
AddItem "California",Address2
AddItem "Florida",Address2
AddItem "Georgia",Address2
AddItem "Guam",Address2
AddItem "Hawaii",Address2
AddItem "Idaho",Address2
AddItem "Illinois",Address2
AddItem "Indiana",Address2
AddItem "Iowa",Address2
AddItem "Kansas",Address2
AddItem "Kentucky",Address2
AddItem "Louisiana",Address2
AddItem "Michigan",Address2
AddItem "Minnesota",Address2
AddItem "Mississippi",Address2
AddItem "Missouri",Address2
AddItem "Nebraska",Address2
AddItem "Nevada",Address2
AddItem "New Jersey",Address2
AddItem "New York",Address2
AddItem "New Mexico",Address2
AddItem "North Carolina",Address2
AddItem "Ohio",Address2
AddItem "Oklahoma",Address2
AddItem "Oregon",Address2
AddItem "Puerto Rico",Address2
AddItem "South Carolina",Address2
AddItem "Tennessee",Address2
AddItem "Texas",Address2
AddItem "Virgin",Address2
AddItem "Islands",Address2
AddItem "Washington",Address2
AddItem "Wisconsin",Address2

rs.movefirst
rs.sort="Region"
%>
<script>
function fShowAddress(){
      oItem = document.forms.frmRegions.strRegion;
      destination = oItem.options[oItem.selectedIndex].value;
      document.forms.frmRegions.strAddress.value=destination;
}
</script>
<form name="frmRegions">
<select name="strRegion" onChange="fShowAddress()">
<option value="" selected>Select your region</option>
<%
while not rs.EOF
%>
      <option value="<%= rs("Address") %>"><%= rs("Region") %></option>
<%
      rs.movenext
wend
%>
</select>
<br>
Address:<br>
<!--<input type="text" name="strAddress">-->
<textarea name="strAddress" cols="40" rows="5"></textarea>
</form>
0
AgentSmith007Commented:
Here ya go:

<%
set rs=Server.CreateObject("ADODB.recordset")
'If you don't have SQL Server installed, you'll have to enter the VALUE of the DataTypeEnum, for example, below, 200 is a string, 3 is an integer...complete list can be found here: http://www.devguru.com/Technologies/ado/quickref/recordset_fieldscollection.html
rs.Fields.Append "Region",200,100
rs.Fields.Append "Address", 200, 200
rs.open

Address1 = "Small Business Administration" & chr(10) & "Division of Program Certification and Eligibility" & chr(10) & "Robert N.C. Nix Federal Building" & chr(10) & "900 Market Street, 5th Floor" & chr(10) & "Philadelphia, PA 19107"
Address2 = "Small Business Administration" & chr(10) & "Division of Program Certification and Eligibility" & chr(10) & "455 Market Street, 6th Floor" & chr(10) & "San Francisco, CA 94105"


sub AddItem(Region,Address)
      rs.AddNew
      rs("Region") = Region
      rs("Address") = Address
      rs.Update
      rs.movelast
end sub
'Adding a row (You can prolly simplifily this with a function)
AddItem "Colorado",Address1
AddItem "Connecticut",Address1
AddItem "Delaware",Address1
AddItem "Maine",Address1
AddItem "Maryland",Address1
AddItem "Massachusetts",Address1
AddItem "Montana",Address1
AddItem "New Hampshire",Address1
AddItem "North Dakota",Address1
AddItem "Pennsylvania",Address1
AddItem "Rhode Island",Address1
AddItem "South Dakota",Address1
AddItem "Utah",Address1
AddItem "Vermont",Address1
AddItem "Virginia",Address1
AddItem "Washington, D.C.",Address1
AddItem "West Virginia",Address1
AddItem "Wyoming",Address1

AddItem "Alabama",Address2
AddItem "Alaska",Address2
AddItem "Arizona",Address2
AddItem "Arkansas",Address2
AddItem "California",Address2
AddItem "Florida",Address2
AddItem "Georgia",Address2
AddItem "Guam",Address2
AddItem "Hawaii",Address2
AddItem "Idaho",Address2
AddItem "Illinois",Address2
AddItem "Indiana",Address2
AddItem "Iowa",Address2
AddItem "Kansas",Address2
AddItem "Kentucky",Address2
AddItem "Louisiana",Address2
AddItem "Michigan",Address2
AddItem "Minnesota",Address2
AddItem "Mississippi",Address2
AddItem "Missouri",Address2
AddItem "Nebraska",Address2
AddItem "Nevada",Address2
AddItem "New Jersey",Address2
AddItem "New York",Address2
AddItem "New Mexico",Address2
AddItem "North Carolina",Address2
AddItem "Ohio",Address2
AddItem "Oklahoma",Address2
AddItem "Oregon",Address2
AddItem "Puerto Rico",Address2
AddItem "South Carolina",Address2
AddItem "Tennessee",Address2
AddItem "Texas",Address2
AddItem "Virgin",Address2
AddItem "Islands",Address2
AddItem "Washington",Address2
AddItem "Wisconsin",Address2

rs.movefirst
rs.sort="Region"
%>
<script>
function fShowAddress(){
      oItem = document.forms.frmRegions.strRegion;
      destination = oItem.options[oItem.selectedIndex].value;
      document.forms.frmRegions.strAddress.value=destination;
}
</script>
<form name="frmRegions">
<select name="strRegion" onChange="fShowAddress()">
<option value="" selected>Select your region</option>
<%
while not rs.EOF
%>
      <option value="<%= rs("Address") %>"><%= rs("Region") %></option>
<%
      rs.movenext
wend
%>
</select>
<br>
Address:<br>
<!--<input type="text" name="strAddress">-->
<textarea name="strAddress" cols="40" rows="7"></textarea>
</form>
0
Carl TawnSystems and Integration DeveloperCommented:
If you are using a select box then you can simply set the value as either "San Francisco" or "Philadelphia". Something like:

<html>
    <head>
        <script language="javascript">
            function SetDestination( obj )
            {
                document.getElementById("Dest").value = obj.value
            }
        </script>
    </head>
    <body>
        <form>
            Select your region:
            <select name="cboRegion" id="cboRegion" onchange="SetDestination(this);">
                <option value="Philadelphia">Colorado</option>
                <option value="Philadelphia">Delaware</option>
                <option value="San Francisco">Alabama</option>
                <option value="San Francisco">Arizona</option>
            </select>
            <br>
            Destination: <input type="text" name="Dest" id="Dest" DISABLED>
        </form>
    </body>
</html>

Of course, if you use this method then you won't be able to get the selected city when the form is submitted.

Hope this helps.
0
MelfekyAuthor Commented:
QuazzMoto ,
i have tried ur solution but i got nothing, would you check it and let me know whats wrong,
 here is the form,
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script>
function fillField()
{
   if(document.form1.ddRegion.value == "Ohio")
      docuement.form1.txtSendTo.value = "San Fran";
   else if(document.form1.ddRegion.value == "Virgin")
       document.form1.txtSendTo.value = "Florida";

}

</script>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="">
  <select name="list1" onClick = "fillField();">
    <option>Ohio</option>
    <option>Oklahoma</option>
    <option>Tennessee</option>
    <option>Virgin</option>
  </select>
  <input type="text" name="ddRegion">
</form>
</body>
</html>
0
MelfekyAuthor Commented:
Agentsmith ,
it works fine now, thanks.
0
AgentSmith007Commented:
Melfeky, have you tried my latest posted solution? This answers your question quite completely:

<%
set rs=Server.CreateObject("ADODB.recordset")
'If you don't have SQL Server installed, you'll have to enter the VALUE of the DataTypeEnum, for example, below, 200 is a string, 3 is an integer...complete list can be found here: http://www.devguru.com/Technologies/ado/quickref/recordset_fieldscollection.html
rs.Fields.Append "Region",200,100
rs.Fields.Append "Address", 200, 200
rs.open

Address1 = "Small Business Administration" & chr(10) & "Division of Program Certification and Eligibility" & chr(10) & "Robert N.C. Nix Federal Building" & chr(10) & "900 Market Street, 5th Floor" & chr(10) & "Philadelphia, PA 19107"
Address2 = "Small Business Administration" & chr(10) & "Division of Program Certification and Eligibility" & chr(10) & "455 Market Street, 6th Floor" & chr(10) & "San Francisco, CA 94105"


sub AddItem(Region,Address)
      rs.AddNew
      rs("Region") = Region
      rs("Address") = Address
      rs.Update
      rs.movelast
end sub
'Adding a row (You can prolly simplifily this with a function)
AddItem "Colorado",Address1
AddItem "Connecticut",Address1
AddItem "Delaware",Address1
AddItem "Maine",Address1
AddItem "Maryland",Address1
AddItem "Massachusetts",Address1
AddItem "Montana",Address1
AddItem "New Hampshire",Address1
AddItem "North Dakota",Address1
AddItem "Pennsylvania",Address1
AddItem "Rhode Island",Address1
AddItem "South Dakota",Address1
AddItem "Utah",Address1
AddItem "Vermont",Address1
AddItem "Virginia",Address1
AddItem "Washington, D.C.",Address1
AddItem "West Virginia",Address1
AddItem "Wyoming",Address1

AddItem "Alabama",Address2
AddItem "Alaska",Address2
AddItem "Arizona",Address2
AddItem "Arkansas",Address2
AddItem "California",Address2
AddItem "Florida",Address2
AddItem "Georgia",Address2
AddItem "Guam",Address2
AddItem "Hawaii",Address2
AddItem "Idaho",Address2
AddItem "Illinois",Address2
AddItem "Indiana",Address2
AddItem "Iowa",Address2
AddItem "Kansas",Address2
AddItem "Kentucky",Address2
AddItem "Louisiana",Address2
AddItem "Michigan",Address2
AddItem "Minnesota",Address2
AddItem "Mississippi",Address2
AddItem "Missouri",Address2
AddItem "Nebraska",Address2
AddItem "Nevada",Address2
AddItem "New Jersey",Address2
AddItem "New York",Address2
AddItem "New Mexico",Address2
AddItem "North Carolina",Address2
AddItem "Ohio",Address2
AddItem "Oklahoma",Address2
AddItem "Oregon",Address2
AddItem "Puerto Rico",Address2
AddItem "South Carolina",Address2
AddItem "Tennessee",Address2
AddItem "Texas",Address2
AddItem "Virgin",Address2
AddItem "Islands",Address2
AddItem "Washington",Address2
AddItem "Wisconsin",Address2

rs.movefirst
rs.sort="Region"
%>
<script>
function fShowAddress(){
      oItem = document.forms.frmRegions.strRegion;
      destination = oItem.options[oItem.selectedIndex].value;
      document.forms.frmRegions.strAddress.value=destination;
}
</script>
<form name="frmRegions">
<select name="strRegion" onChange="fShowAddress()">
<option value="" selected>Select your region</option>
<%
while not rs.EOF
%>
      <option value="<%= rs("Address") %>"><%= rs("Region") %></option>
<%
      rs.movenext
wend
%>
</select>
<br>
Address:<br>
<!--<input type="text" name="strAddress">-->
<textarea name="strAddress" cols="40" rows="7"></textarea>
</form>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MelfekyAuthor Commented:
yes , i did, and by the way this is exactly what i wanted.
But let me first read through your code so i can get the whole idea of your code.
0
AgentSmith007Commented:
ok...it basically uses the ADO recordset object which allows for easy sorting & future modification with ease. A javascript or other solution is quite feasible without this built-in sorting functionality, but since this is the ASP channel, I figured i'd give you an ASP solution
0
MelfekyAuthor Commented:
AgentSmith,
I have tested your code in the form that u have given me befor , and i have changed the field name to address and region only, and i have set the field name in the access db too to be the same.
When the form opens everything is fine about the select boxs and when submitting the form i got nothing saved in the db, Would u tell me why is that?
Here is the whole code:
<%
'Declare connection object
 Dim straccessdb, conn, strcon
 strAccessDB = "db1.mdb"
 Set Conn = Server.CreateObject("ADODB.Connection")
 strCon = "DRIVER={Microsoft Access Driver (*.mdb)};uid=;pwd=; DBQ=" & Server.MapPath(strAccessDB)
 conn.Open strCon

'Function to make SQL statements not fail w/ special character(s)
function fQueryFriendly(strVar)
     strTemp = strVar
     strTemp = Replace(strTemp,"'","''")
     fQueryFriendly = strTemp
end function
'Set current user
dim M_USERNAME
M_USERNAME = session("user")
       
if request.form("iSaveAll") = "1" then
       'Saving entire form
     strSQL = "UPDATE check SET "
     strSQL = strSQL & "Region = '" & fQueryFriendly(request.form("Region")) & "'"
     strSQL = strSQL & ",Address = '" & fQueryFriendly(request.form("Address")) & "'"


      
      
        strSQL = strSQL & "WHERE M_USERNAME = '" & session("user") & "'"
     conn.execute(strSQL)
End If


'read from db
strSQL ="SELECT * FROM check WHERE M_USERNAME = '" & Session("user") & "'"
Set oRS = conn.Execute(strSQL)
while not oRS.Eof
     'get the data
     Region = oRS("Region")
     Address = oRS("Address")

        
        
        oRS.MoveNext
wend
oRS.close
set oRS = nothing

set rs=Server.CreateObject("ADODB.recordset")
'If you don't have SQL Server installed, you'll have to enter the VALUE of the DataTypeEnum, for example, below, 200 is a string, 3 is an integer...complete list can be found here: http://www.devguru.com/Technologies/ado/quickref/recordset_fieldscollection.html
rs.Fields.Append "Region",200,100
rs.Fields.Append "Address", 200, 200
rs.open

Address1 = "Small Business Administration" & chr(10) & "Division of Program Certification and Eligibility" & chr(10) & "Robert N.C. Nix Federal Building" & chr(10) & "900 Market Street, 5th Floor" & chr(10) & "Philadelphia, PA 19107"
Address2 = "Small Business Administration" & chr(10) & "Division of Program Certification and Eligibility" & chr(10) & "455 Market Street, 6th Floor" & chr(10) & "San Francisco, CA 94105"


sub AddItem(Region,Address)
     rs.AddNew
     rs("Region") = Region
     rs("Address") = Address
     rs.Update
     rs.movelast
end sub
'Adding a row (You can prolly simplifily this with a function)
AddItem "Colorado",Address1
AddItem "Connecticut",Address1
AddItem "Delaware",Address1
AddItem "Maine",Address1
AddItem "Maryland",Address1
AddItem "Massachusetts",Address1
AddItem "Montana",Address1
AddItem "New Hampshire",Address1
AddItem "North Dakota",Address1
AddItem "Pennsylvania",Address1
AddItem "Rhode Island",Address1
AddItem "South Dakota",Address1
AddItem "Utah",Address1
AddItem "Vermont",Address1
AddItem "Virginia",Address1
AddItem "Washington, D.C.",Address1
AddItem "West Virginia",Address1
AddItem "Wyoming",Address1

AddItem "Alabama",Address2
AddItem "Alaska",Address2
AddItem "Arizona",Address2
AddItem "Arkansas",Address2
AddItem "California",Address2
AddItem "Florida",Address2
AddItem "Georgia",Address2
AddItem "Guam",Address2
AddItem "Hawaii",Address2
AddItem "Idaho",Address2
AddItem "Illinois",Address2
AddItem "Indiana",Address2
AddItem "Iowa",Address2
AddItem "Kansas",Address2
AddItem "Kentucky",Address2
AddItem "Louisiana",Address2
AddItem "Michigan",Address2
AddItem "Minnesota",Address2
AddItem "Mississippi",Address2
AddItem "Missouri",Address2
AddItem "Nebraska",Address2
AddItem "Nevada",Address2
AddItem "New Jersey",Address2
AddItem "New York",Address2
AddItem "New Mexico",Address2
AddItem "North Carolina",Address2
AddItem "Ohio",Address2
AddItem "Oklahoma",Address2
AddItem "Oregon",Address2
AddItem "Puerto Rico",Address2
AddItem "South Carolina",Address2
AddItem "Tennessee",Address2
AddItem "Texas",Address2
AddItem "Virgin",Address2
AddItem "Islands",Address2
AddItem "Washington",Address2
AddItem "Wisconsin",Address2

rs.movefirst
rs.sort="Region"
%>
<script>
function fShowAddress(){
     oItem = document.forms.frmRegions.Region;
     destination = oItem.options[oItem.selectedIndex].value;
     document.forms.frmRegions.Address.value=destination;
}
</script>
<form name="frmRegions" method="POST">
<select name="Region" onChange="fShowAddress()" >
<option value="" selected>Select your region</option>
<%
while not rs.EOF
%>
     <option value="<%= rs("Address") %>"><%= rs("Region") %></option>
<%
     rs.movenext
wend
%>
</select>
<br>
Address:<br>
<!--<input type="text" name="Address">-->
<textarea name="Address" cols="40" rows="7" value="<%= Address %>"></textarea>
  <input type="submit" name="Submit" value="Submit">
</form>
0
MelfekyAuthor Commented:
Any way , i shall close this question now as my last question shall be put into another topic because my question was answered here.
Agentsmith,
if u have some time would u check it here in this link:
http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21221457.html
0
MelfekyAuthor Commented:
Agentsmith,
the problem of saving into the db is solved but unfortunatlly it is solved in a wrong way,
in this way:
The region field should save only the selected region(South Carolina,Tennessee,etc...)
but it saves thie value that is supposed to be for the address which is this:
"Small Business Administration
Division of Program Certification and Eligibility
Robert N.C. Nix Federal Building
900 Market Street, 5th Floor
Philadelphia, PA 19107"


But the address field saves  always:"Small Business Administration" in it.
Would you look throught the code and let me know whats going wrong
 Thanks
0
MelfekyAuthor Commented:
you can answer me this question in this topic:
http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21221457.html
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.