473,385 Members | 1,347 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

dynamically populate drop down menu option value problem

hi

I was wondering if anyone can help me out on this....

I have dynamcally populated a drop down menu with data from an access
database using ASP. The values seem fine, however when i pass them to
the next page (using form get method) the whitespaces in the values
are ignored. For example with <option value=jim jones> then only "jim"
gets passed to the next page not "jim jones". I have viewed the source
created on the dynamic page and the values are populated fine, but
passing to the next page seems to be problematic...

My code....

<form name="search2"
<%if registered then%>
action="xresults1.asp"
<%else%>
action="xresults.asp"
<%end if%>
method="get">

<%

if isempty(Application("Recordset2strcacheUsers")) then

Set db = Server.CreateObject("ADODB.Connection")
db.Open MM_database2_STRING

Set Recordset2 = db.Execute("SELECT DISTINCT Field2 FROM IaxData WHERE
Field19 = '1'")

'*******populate drop down list********

Recordset2str = "<SELECT NAME=subject><OPTION
value=choose>Subject</OPTION>"
while not Recordset2.eof
Recordset2str = Recordset2str & "<OPTION VALUE=" &
Recordset2.fields("Field2") & ">" & Recordset2.fields("Field2") &
"</OPTION>"
Recordset2.moveNext
wend

Recordset2str = Recordset2str & "</SELECT>"
Response.write("<br>from database<br>" & Recordset2str)

'********write to cache***********
Application.lock()
Application("Recordset2strcacheUsers") = Recordset2str
Application.unlock()

db.Close
Set db = Nothing

else
' Write from cache
Response.write("<BR>from cache<BR>" & Application
("Recordset2strcacheUsers"))

end if
%>

</form>
Jul 19 '05 #1
3 11224
Enclose your values in quotes.

Recordset2str = Recordset2str & "<OPTION VALUE=""" &
Recordset2.fields("Field2") & """>" & Recordset2.fields("Field2") &
"</OPTION>"

Ray at home

--
Will trade ASP help for SQL Server help
"julian" <ju***********@talk21.com> wrote in message
news:19**************************@posting.google.c om...
hi

I was wondering if anyone can help me out on this....

I have dynamcally populated a drop down menu with data from an access
database using ASP. The values seem fine, however when i pass them to
the next page (using form get method) the whitespaces in the values
are ignored. For example with <option value=jim jones> then only "jim"
gets passed to the next page not "jim jones". I have viewed the source
created on the dynamic page and the values are populated fine, but
passing to the next page seems to be problematic...

My code....

<form name="search2"
<%if registered then%>
action="xresults1.asp"
<%else%>
action="xresults.asp"
<%end if%>
method="get">

<%

if isempty(Application("Recordset2strcacheUsers")) then

Set db = Server.CreateObject("ADODB.Connection")
db.Open MM_database2_STRING

Set Recordset2 = db.Execute("SELECT DISTINCT Field2 FROM IaxData WHERE
Field19 = '1'")

'*******populate drop down list********

Recordset2str = "<SELECT NAME=subject><OPTION
value=choose>Subject</OPTION>"
while not Recordset2.eof
Recordset2str = Recordset2str & "<OPTION VALUE=" &
Recordset2.fields("Field2") & ">" & Recordset2.fields("Field2") &
"</OPTION>"
Recordset2.moveNext
wend

Recordset2str = Recordset2str & "</SELECT>"
Response.write("<br>from database<br>" & Recordset2str)

'********write to cache***********
Application.lock()
Application("Recordset2strcacheUsers") = Recordset2str
Application.unlock()

db.Close
Set db = Nothing

else
' Write from cache
Response.write("<BR>from cache<BR>" & Application
("Recordset2strcacheUsers"))

end if
%>

</form>

Jul 19 '05 #2
thx ray.
always boils down to punctuation!
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #3
you need to enclose the value with ""... i.e.
Recordset2str = "<SELECT NAME=subject><OPTION
value=choose>Subject</OPTION>"
while not Recordset2.eof
Recordset2str = Recordset2str & "<OPTION VALUE=""" &
Recordset2.fields("Field2") & """>" & Recordset2.fields("Field2") &
"</OPTION>"
Recordset2.moveNext
wend

Recordset2str = Recordset2str & "</SELECT>"
Response.write("<br>from database<br>" & Recordset2str)
"julian" <ju***********@talk21.com> wrote in message
news:19**************************@posting.google.c om... hi

I was wondering if anyone can help me out on this....

I have dynamcally populated a drop down menu with data from an access
database using ASP. The values seem fine, however when i pass them to
the next page (using form get method) the whitespaces in the values
are ignored. For example with <option value=jim jones> then only "jim"
gets passed to the next page not "jim jones". I have viewed the source
created on the dynamic page and the values are populated fine, but
passing to the next page seems to be problematic...

My code....

<form name="search2"
<%if registered then%>
action="xresults1.asp"
<%else%>
action="xresults.asp"
<%end if%>
method="get">

<%

if isempty(Application("Recordset2strcacheUsers")) then

Set db = Server.CreateObject("ADODB.Connection")
db.Open MM_database2_STRING

Set Recordset2 = db.Execute("SELECT DISTINCT Field2 FROM IaxData WHERE
Field19 = '1'")

'*******populate drop down list********

Recordset2str = "<SELECT NAME=subject><OPTION
value=choose>Subject</OPTION>"
while not Recordset2.eof
Recordset2str = Recordset2str & "<OPTION VALUE=" &
Recordset2.fields("Field2") & ">" & Recordset2.fields("Field2") &
"</OPTION>"
Recordset2.moveNext
wend

Recordset2str = Recordset2str & "</SELECT>"
Response.write("<br>from database<br>" & Recordset2str)

'********write to cache***********
Application.lock()
Application("Recordset2strcacheUsers") = Recordset2str
Application.unlock()

db.Close
Set db = Nothing

else
' Write from cache
Response.write("<BR>from cache<BR>" & Application
("Recordset2strcacheUsers"))

end if
%>

</form>

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: C. David Rossen | last post by:
Hello: I have a registration form for classes. Each class has a fee. I have a drop down box whereby the user chooses his class. There is a textbox with the associated fee. I would like to...
6
by: Greg Scharlemann | last post by:
I am attempting to populate a drop down menu based on the selection of a different drop down menu. However, it is not working correctly, I cannot figure out for the life of me what exactly happens...
1
by: Greg Scharlemann | last post by:
I would like to automatically populate a drop down menu when the page loads based on the selection of an item in a different drop down menu. I made a test page that when drop down #1 changes, drop...
4
by: Yuk Cheng | last post by:
<<<start index.htm>>> <html> <head> <script> function perform(action){ } </script> </head>
2
by: Boujii | last post by:
Greetings, I have been attempting to make a drop down menu of countries. From this menu I wish to create a variable in order to INPUT into mysql database. I have no trouble making the drop down menu,...
1
by: Kaland | last post by:
Do the search engines follow links that are within forms (like the drop-down menu) so that those pages are indexed? Here is the code for a sample drop-down menu that I created. <form><select...
5
by: giandeo | last post by:
Hello Experts. Could you find a solution for this problem please! I have the following tables in Access Database Table Name: origin Fields Names: country, countrycode Table Name: make...
6
by: phpnewbie26 | last post by:
My current form has one multiple select drop down menu as well as few other drop down menus that are single select. Originally I had it so that the multiple select menu was first, but this created...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.