|
-
Jan 9th, 2001, 06:18 AM
#1
Thread Starter
Hyperactive Member
Hi,
I have a website with 3 main pages - COUNTRY,STATE,CITY and then a DETAILS page.
On the COUNTRY page you select a COUNTRY, click submit, it the opens up the STATE page where you choose a STATE,click submit, the CITY page opens, you choose a city, click submit and then the DETAILS page opens showing details about the COUNTRY/STATE/CITY combination chosen!!
Now, some COUNTRIES do not have STATES (or I dont have them on my DB). At this stage, even though there are no STATES for the COUNTRY chosen the STATE page still opens with "ALL" in the dropdown menu..... and then onto CITY etc etc.
I want to change this so that when a COUNTRY is chosen, I want to run a quick query on my STATE table to see whether that COUNTRY does indeed have STATES - if it doesn't I want to redirect directly to the CITY page!!
How do I do this?? How do I know what COUNTRY was chosen before going to the STATE page.
I have this code for the redirect..
<script language="javascript">
function redirectpage()
{
if(document.frmcountry.lstcountry.options[document.frmcountry.lstcountry.selectedIndex].value == 0)
{
document.frmcountry.action = "city.asp";
document.frmcountry.submit();
}
else
{
document.frmcountry.submit();
}
}
</script>
This does not do what I want. My ideal is to have something like....
after the COUNTRY is chosen and the submit button is clicked...
1.) select * from STATES where country = lstcountry
2.) if EOF then (ie. no STATES found for that COUNTRY)
document.frmcountry.action = "city.asp";
document.frmcountry.submit();
else
document.frmcountry.action = "state.asp";
document.frmcountry.submit();
end if
Can I have ASP code within Javascript, because I only know ASP and do not know how to do the "select statement" using Javascript.
Please!!!! Your help will be very much appreciated.
Thank you,
T
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|