to display record of selected person by listbox.....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sweetjos
    New Member
    • Mar 2010
    • 10

    to display record of selected person by listbox.....

    I am retiriveing some names from on database by some conditions....t hat names are being displayed in the listbox........ ..my question is if i select a name that person details should be displayed in the same form..........t hat person's name and other details are stored in same table..........
    Plz help with code.........

    My code is as follows........ .
    Code:
    <%@ 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>
    Last edited by jhardman; Mar 25 '10, 08:57 PM. Reason: added code tags
  • sweetjos
    New Member
    • Mar 2010
    • 10

    #2
    I am retiriveing some names from on database by some conditions....t hat names are being displayed in the listbox........ ..my question is if i select a name that person details should be displayed in the same form..........t hat person's name and other details are stored in same table..........
    Plz help with code.........

    My code is as follows........ .
    Code:
    <%@ 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>
    Last edited by jhardman; Mar 25 '10, 08:53 PM. Reason: added code tags

    Comment

    • jhardman
      Recognized Expert Specialist
      • Jan 2007
      • 3405

      #3
      if using ASP, you are going to have to submit the form, pull up the data, and redisplay the form.

      Jared

      Comment

      Working...