Solved

Option button in ASP

Posted on 2004-03-26
5
276 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to speed up an ASP/MS SQL web application 6 70
Import csv files to MS SQL 5 82
can I post data from an asp page to php page? 4 51
Auto Submit on dropdown box 14 67
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

832 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