Select your institution:
<%
Dim connection
Set connection = Server.CreateObject("ADODB.Connection")
connection.ConnectionString = application("db")
connection.Open
Dim result,result2,result3,result9,result10
Set result = Server.CreateObject("ADODB.RecordSet")
Set result2 = Server.CreateObject("ADODB.RecordSet")
Set result3 = Server.CreateObject("ADODB.RecordSet")
Set result4 = Server.CreateObject("ADODB.RecordSet")
Set result9 = Server.CreateObject("ADODB.RecordSet")
Set result10 = Server.CreateObject("ADODB.RecordSet")
result.CursorType = 3
result2.CursorType = 3
result3.CursorType = 3
result4.CursorType = 3
result9.CursorType = 3
result10.CursorType = 3
' displaying the schools
Dim SQL1,SQL2,SQL3,SQL4,SQL9
'Case 1,2
SQL1 = "SELECT * FROM Institutions"
result.open SQL1,connection %>
Choose Institution
<% while (not result.eof ) %>
<% if result(0)= institution_code then %>
<% dim inst_value
inst_value = result(0)
%>
selected ><%=result(1)%>
<%else %>
><%=result(1)%>
<% end if %>
<% result.movenext
wend
'result.MoveFirst
%>
Select your instructor:
<% ' Case 1
'If no institution is selected, then disable the dropdown.
if institution_code = 0 then%>
Choose Institution First
<% end if %>
<% if institution_code > 0 then%>
<% SQL2 = "SELECT * FROM [InstitutionInstructor] WHERE InstitutionID =" &institution_code
result2.open SQL2,connection
dim instructor_no
instructor_no = result2(1)
'If there are more than one instructors in [InstitutionInstructor] table
'each of them are displayed in the instructor dropdown list box
%>
<%
'if there are no instructors, then disable the dropdown and display an alert.
if (result2.EOF) then
%>
There are no instructors registered for this institution.
You can register as an independent student by clicking
here .
<%else%>
Choose Instructor
<%end if%>
<%
while ( not result2.EOF)
SQL3 = "SELECT * FROM [Instructors] WHERE InstructorID =" & result2(1)
result3.open SQL3,connection
%>
<% if result3(0)= instructor_id then %>
<% dim inst_value2
inst_value2 = result3(0)
%>
selected >
<%=result3("FullName")%>
<%else %>
>
<%=result3("FullName")%>
<% end if %>
<% result3.Close
set result3 = nothing
Set result3 = Server.CreateObject("ADODB.RecordSet")
result2.MoveNext
wend%>
<% end if
%>
Select class:
<%
' Control is directed to this loop when the page is requested for the first time i.e.,
' there is no query string value to retrieve
' The value of inctructor ID is taken from the first record of the [InstitutionInstructor]
' table.
' The instructor ID is used then to retrieve the classes pertaining to that instructor
' from the [Classes]table. %>
<%
' Case 1
' instructor_id is initialized through the querystring from change_checkbox2()
if (institution_code = 0) and (instructor_id = 0) then
%>
---------------------------------
<%
end if
%>
<%
' Control is directed to this section when changes
' are made to the institution drop down list
if institution_code > 0 then
if instructor_id = 0 then
%>
Choose Instructor Now
<% end if
end if %>
<%
' Control is passed on to this section when the instructor is chosen from the instructor
' dropdown list.Classes change accordingly.
if (institution_code > 0) and (instructor_id > 0) then
SQL4 = "SELECT * FROM Classes WHERE InstructorID="& instructor_id
result4.open SQL4,connection
%>
<%if result4.EOF then%>
The Instructor has not yet created a class for you to enroll in.
Did you choose the correct instructor from the list? If not, go back to the dropdown list.
If there is no class to enrol in, please enroll as an independent student by clicking here .
<%else
EnablePassword=true
%>
<%end if%>
<%
while (not result4.eof )
%>
>
Class Name: <%=result4(0)%>, Line Number: <%=result4(1)%>
<% result4.movenext
wend
%>
<%
end if
result.Close
result2.Close
result3.Close
result4.Close
result9.Close
result10.Close
set result = nothing
set result2 = nothing
set result3 = nothing
set result4 = nothing
set result9 = nothing
set result10 = nothing
%>
<% If (EnablePassword=true) then%>
Enter the class password:
<%else%>
Enter the class password:
<%end if%>