Solved

Option button in ASP

Posted on 2004-03-26
5
261 Views
Last Modified: 2012-08-14
Hi,

Here is the scenario, I want the user to choose the country from the list and once the user click on the country then the other option button will list down the state of the country selected by the user without click on the submit button.
It just like the sign up page in the hotmail.
I am using access to retrieve the country.
How to do this? And is it possible all this things done in the same page without have to link to other page?

Thanks in advance
Yzh
0
Comment
Question by:Yzh
5 Comments
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10693884
0
 
LVL 12

Expert Comment

by:str_kani
ID: 10694060
hi,
Will you display all the countries in the world or only a few and its states, we can choose  the best one depends on the requirement. Please let me know how many countries and states you will use...
(tell me approximately)
regards
kani
0
 

Author Comment

by:Yzh
ID: 10700807
Well, I will put 10 countries but in the future I may put more..so, I want it to be dynamic..which approach is better? client-side or server-side?

Regards,
Yzh
0
 
LVL 1

Expert Comment

by:Nandhini
ID: 10958551
server side is the best approach
0
 
LVL 1

Accepted Solution

by:
Nandhini earned 80 total points
ID: 10965992
it is possible to do in a single page

page - first.asp
-----------------

<%
  ur connection stmt .............
%>
<html>
<body>
<form name="form1" method="post" action="first.asp">
<select name="country" onchange="javascript:form1.submit();">
<%
   select all the countries from the database
    If not cnt.eof then
     cnt.movefirst
     If Request.Form("country") <> "" then
       country = Request.Form("country")
     Else
       country = cnt("country_field_name")
     End If
     Do while not cnt.eof
      If strcomp(country,cnt("country_field_name"),1) = 0 then
%>
        <option value="<%=cnt("country_field_name")%>"><%=cnt("country_field_name")%> SELECTED></option>
<%
      else
%>
        <option value="<%=cnt("country_field_name")%>"><%=cnt("country_field_name")%></option>
<%
       end if
      cnt.movenext
    loop
    end if
 %>
</select>
<select name="state">
<%
  set st = conobj.execute("select states from state_table_name where country='"&country&"'")
  If not st.eof then
   st.movefirst
   Do while not st.eof
%>
     <option value="<%=st("state")%>"><%=st("state")%></option>
<%  
    st.movenext
   Loop
  end if
%>
</select>
</form>
</body>
</html>
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now