Hello,
I am experiencing some problems creating a drop down menu that is populated from a database. The problem is when the page is submitted, it doesnt populate the drop down menu with the selection.
The info from the database is populated into an array and fed into the form....
The database is basically like this:
PlanID (autonum) PlanName (text)
1 First Plan Name
2 Second Plan Name
I have noticed that when I compare Plan Name to Plan Name, it populates the correct answer. However, when I compare PlanID with the answer in request.form, it doesnt work.
Does the fact I am comparing a number have anything to do with it?
Appreciate your help!
spiff
'populating drop down menus
set rsold = connection.execute("Select * from oldplan order by Plan asc"
oldlist = rsold.getrows()
const oldid = 0
const old_plan = 1
if request.form.count > 1 then
theoldplan = request.form("oldplan"
end if
Old Plan:
<select size="1" name="oldplan">
<option value="0">Select the old plan</option>
<% for i = 0 to ubound(oldlist, 2) %>
<option value="<%= oldlist(oldid, i) %>"
<% if theoldplan = oldlist(oldid, i) then response.write "selected" %>><%= oldlist(old_plan, i) %> - <%= oldlist(oldid, i) %></option>
<% next %>
</select>
This is the gist of it. If I change everything to oldlist(old_plan, i), then it works perfectly.
Thanks
I am experiencing some problems creating a drop down menu that is populated from a database. The problem is when the page is submitted, it doesnt populate the drop down menu with the selection.
The info from the database is populated into an array and fed into the form....
The database is basically like this:
PlanID (autonum) PlanName (text)
1 First Plan Name
2 Second Plan Name
I have noticed that when I compare Plan Name to Plan Name, it populates the correct answer. However, when I compare PlanID with the answer in request.form, it doesnt work.
Does the fact I am comparing a number have anything to do with it?
Appreciate your help!
spiff
'populating drop down menus
set rsold = connection.execute("Select * from oldplan order by Plan asc"
oldlist = rsold.getrows()
const oldid = 0
const old_plan = 1
if request.form.count > 1 then
theoldplan = request.form("oldplan"
end if
Old Plan:
<select size="1" name="oldplan">
<option value="0">Select the old plan</option>
<% for i = 0 to ubound(oldlist, 2) %>
<option value="<%= oldlist(oldid, i) %>"
<% if theoldplan = oldlist(oldid, i) then response.write "selected" %>><%= oldlist(old_plan, i) %> - <%= oldlist(oldid, i) %></option>
<% next %>
</select>
This is the gist of it. If I change everything to oldlist(old_plan, i), then it works perfectly.
Thanks