Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to redirect the page of a info click in a drop-down box

Status
Not open for further replies.

hoog

Technical User
Feb 28, 2007
8
US
Hi, i want to do a function that whenever you click a information on the drop-down box,it will redirect to the webpage of the information when i click a "SUBMIT" button.


So is it possible...

And below is my coding:



Dim h, name
Dim SQL,Rs2
Dim Rs, Con, ConnString
Dim Con1

Set Rs=Server.CreateObject ("ADODB.CONNECTION")
'set Rs2=Server.CreateObject ("ADODB.CONNECTION")

ConnString="driver={sql server};server=o6f2e1;database=user;DSN=localserver;PWD=;UID=sa;"

Rs.Open ConnString

SQL = "select * from info "

Set Con=Rs.Execute (SQL)

SQL= "select * from Course"

Set Con1=Rs.execute (SQL)


IF not Con1.EOF then
if not Con.EOF then
'Con1.MoveNext
'Con.MoveNext

Response.Write ("Your Profile:")
Response.Write (&quot;<p>&quot;)
Response.Write (&quot;Name:&quot; & Con.fields(&quot;NameID&quot;))
Response.Write (&quot;<p>&quot;)
Response.Write (&quot;Department:&quot; & Con.fields(&quot;Department&quot;))
Response.Write (&quot;<p>&quot;)
Response.Write (&quot;Option:&quot; & Con.fields(&quot;OptionChosen&quot;))
Response.Write (&quot;<p>&quot;)
Response.Write (&quot;View your Modules:&quot;)

If Not Con1.EOF Then
Con1.MoveFirst
'the form below calls this file only this time with an id in the QueryString
%>
<form action=&quot;View.asp&quot; method=&quot;get&quot; id=form1 name=form1>
<select name=UserID>
<option></option>
<%

Do While Not Con1.EOF
%>
<option value=&quot;<%= Con1.Fields(&quot;UserID&quot;)%>&quot;><%= Con1.Fields(&quot;Modules&quot;)%></option>
<%

Con1.MoveNext

Loop
%>
</select>
<input type=&quot;submit&quot; value=&quot;Submit&quot; id=submit1 name=submit1>
</form>
<%

End if

End if
End if
%>
 
The easiest way I know is to set up a &quot;redirect&quot; page that takes the results of the form submittal, and redirects accordingly. Something like:
============================================================

viewpage = Request.Form(&quot;UserID&quot;)

if newpage = &quot;option1&quot; then response.redirect(&quot;page1.html&quot;)
if newpage = &quot;option2&quot; then response.redirect(&quot;page2.html&quot;)
if newpage = &quot;option3&quot; then response.redirect(&quot;page3.html&quot;)
if newpage = &quot;option4&quot; then response.redirect(&quot;page4.html&quot;)

============================================================
 
Client Side scripting, just use javascript or the like in an onchange in the dropdown to change the form.action target to something based on the value of the selected option, that way you want lose any form info
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top