Radio choice redirect (Rated 4)Description:
You can use this simple ASP snippet to redirect a visitor to another page depending on what choice they make with a radio button Code starts here
<% @Language="VBScript"%>
<%
Option Explicit
%>
<!-- METADATA TYPE="typelib"
FILE="C:\Program Files\Common Files\System\ado\msado15.dll" -->
<%
' coded by Utopia
' http://www.designplace.org/
' a sub that redirects based on radio choice
Sub redirectMe()
' declare a variable for the choice
dim strChoice
' give the variable the value of the choice
strChoice = Request.Form("choice")
' if strChoice isnt empty
if strChoice <> "" then
' start a select case statement to decide where we redirect to
select case strChoice
case "1"
response.redirect "http://www.designplace.org/index.php"
case "2"
response.redirect "http://www.designplace.org/scripts.php"
case "3"
response.redirect "http://www.designplace.org/forum/"
case else
response.write "something else was chosen..."
end select
end if
End Sub
%>
<html>
<head>
<title>Utopia is my hero</title>
</head>
<body>
<form method="post">
1.) <input type="radio" name="choice" value="1" />
2.) <input type="radio" name="choice" value="2" />
3.) <input type="radio" name="choice" value="3" />
<input type="submit" value="submit" />
</form>
<%
' call our sub
call redirectMe()
%>
</body>
</html>
Submitted by Devscripts on 23-02-2003 22:44 |