below is my ASP classic code.i having a problem when put if else statement like that..actually it’s not working..what i want to do is when i select USA then submit it will show selected USA..default is ALL.sorry for my bad English.
<% Response.write"<form action=""untitled.asp"" method=""post"">"
Response.write"<select name=""country"">"
Response.write"<option selected>ALL</option>"
Response.write" <option value=""1"" if request(""country"")=""1"" then
Response.Write""selected"">USA</option>"
Response.write" <option value=""2"" if request(""country"")=""2"" then
Response.Write""selected"">BRAZIL</option>"
Response.write"<label>"
Response.write" <input type=submit name=button id=button value=Submit />"
Response.write"</label>"
Response.write"</form>"
%>
thanks
Your basic syntax is wrong. This is how it should be done:
And same for the second option. To make it more flexible and readable, use a function:
Then use it like this: