I am retrieving some names from a database based on some conditions. The names are then displayed in a listbox. When I select a name, that person's details should be displayed in the same form. The person's name and other details are stored in the same table. How can I do this?
Please help with code.........
My code is as follows.........
<%@ Language = VBScript%>
<% Response.Buffer = True
%>
<html>
<head>
<title>PERSONAL DETAILS</title>
</head>
<body>
<%
Dim da
da = date()
Dim rs
Set rs = Server.CreateObject ("ADODB.Recordset")
rs.Open "details", "DSN=Personal"
Dim yy
Dim mm
dim age, caste, rscaste, ageto, gender
age = Request.Form ("D1") '( Taken from another form in another asp file)
caste = Request.Form ("D2")
ageto = Request.Form ("D3")
gender = Request.Form ("R1")
a = cint (age)
b = cint (ageto) %>
<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" u-file="fpweb:///_private/form_results.csv" s-format="TEXT/CSV" s-label-fields="TRUE" --><p>
Name&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp; <select size="1" name="D1" size = "20">
<% While Not rs.EOF
' FINDING AGE
mm = DateDiff("m", rs("DOB"), da)
if mm >= 12 then
yy = cint(mm/12)
end if
' Selecting records by age
for i = age to ageto
rscaste = rs("Caste")
if yy = i then
' Selecting records by caste
if caste = rscaste then
' Selecting records by Gender
if not rs("Gender") = gender then
%>
<option value = "<%=rs("Name")%>"><%=rs("Name")%></option>
<%
end if
end if
end if
next
rs.MoveNext
Wend %></select></form>
<%
rs.Close
Set rs = Nothing
%>
</body>
</html>