%@ Language=VBScript %> <% Response.Buffer = True %> <% Function Search(strFirstName,strLastName) 'search through the text file for the student with strFirstName and strLastname Dim objFile,objFileSystemObject,objFS Dim strDummy1,strDummy2,strDummy3,strFirst,strLast Dim strHomePhone, strWorkPhone, strEMail 'create the FileSystemObject Set objFileSystemObject = CreateObject("Scripting.FileSystemObject") 'create a File object linked to the file specified in the strServerFilePath property Set objFile = objFileSystemObject.GetFile(strServerFilePath) 'open the file as a TextStream object Set objFS = objFile.OpenAsTextStream(1, -2) 'loop through each block of 5 lines of the file - corresponds to a single student Do While Not objFS.AtEndOfStream strFirst = UCASE(objFS.ReadLine) strLast = UCASE(objFS.ReadLine) strHomePhone = (objFS.ReadLine) strWorkPhone = (objFS.ReadLine) strEMail = objFS.ReadLine 'test the name of the student against the data from the file If (UCASE(strFirstName) = strFirst) and (UCASE(strLastName) = strLast) Then 'we have a match so save the data strMode = "Browse" colFormElements.RemoveAll colFormElements.Add "txtFirstName", strFirstName colFormElements.Add "txtLastName", strLastName colFormElements.Add "txtHomePhone", strHomePhone colFormElements.Add "txtWorkPhone", strWorkPhone colFormElements.Add "txtemail", strEMail Search = True objFS.close Exit Function End If Loop Search = False objFS.close End Function Sub SaveStudent 'save the details of the new student to the file Dim objFileSystemObject, objFile, objFS Set objFileSystemObject = CreateObject("Scripting.FileSystemObject") 'test the student record file exists If Not objFileSystemObject.FileExists(strServerFilePath) Then 'no file so create it Set objFS = objFileSystemObject.CreateTextFile(strServerFilePath) Else 'file exists so link to File object Set objFile = objFileSystemObject.GetFile(strServerFilePath) 'open the file as a TextStream Set objFS = objFile.OpenAsTextStream(8, -2) End If 'write the data in the dictionary object to the file, each record is written as 5 lines For Each strItem in colFormElements 'trim off any spaces before writing the line objFS.WriteLine trim(colFormElements.Item(strItem)) Next 'close the file objFS.Close 'clear the TextStream object set objFS = Nothing 'clear the File object set objFile = Nothing 'clear the FileSystemObject object set objFileSystemObject = Nothing End Sub Function FormValidation Dim blnOK 'check the user has completed the required fields of the form blnOK = (Trim(Request.Form("txtFirstName")) = "") OR (Trim(Request.Form("txtLastName")) = "") OR (Trim(Request.Form("txtemail")) = "") 'blnOK will return TRUE if any of the conditions is TRUE because of the OR If blnOK Then 'display a message informing user of the error Response.Write("