Welcome to WebmasterWorld Guest from 22.214.171.124
Forum Moderators: ocean10000
Index out of range
/ml49/si/12-4/searchclass.asp, line 44
An array index is out of range.
the part of the code that gives this error is :
'Check to see if form has been submitted
If Request.QueryString("submit") = "submit" OR _
Request.QueryString("search")<> "" OR _
(Request.QueryString("search")= "" AND Request.QueryString.key(1) = "search") Then
'Check for Errors
strErrors = isValid()
If strErrors<> "" Then
Response.Write"<span class='error'>" & strErrors & "</span>"
Set objRecordset = getMatches()
The Request.QueryString.key(1)="search" is the reason why I believe we get the message. Cos when the page loads first (before the page is submitted) there doesn's exist key-value(key/item) pair to correspond with the request.querystring.key(1).... what could be the possible solutions to this issue?
The reason was Request.QueryString.Key(1) was checking for the key-value pairs and when the page first loaded there werent any key-value pairs. so I used an if-then statement to see if the text field of the form was filled... if it wasnt then it would do nothing otherwise it would check for the key-value string... thanks for the replies...