Forum Moderators: open

Message Too Old, No Replies

Checking for a value in a form

String checking

         

big_zebra

6:21 pm on May 10, 2008 (gmt 0)

10+ Year Member



Hello,
I am trying to check several fields in a form for the values "http://" and "href=".

I added the code in lines 1-7 to an existing working routine, but not having much success. I try to set a flag (sURL) to 1 if the values are found. I then use the flag in another routine to branch around code.

Can someone please check this for me and let me know if I'm the right track? Many thanks.

Function ParseForm()
For Each Item in Request.Form
If objFM.Exists(Item) Then
objFM.Item(Item) = objFM.Item(Item) & "," & Request.QueryString(Item)
Else
objFM.Add Item,Request.Form(Item)
End If
Next
For Each Item in Request.QueryString
If objFM.Exists(Item) Then
objFM.Item(Item) = objFM.Item(Item) & "," & Request.QueryString(Item)

1. strURL = Request.QueryString(Item)
2. If left(lcase(strURL),7)="http://" Then
3. sURL = 1
4. ElseIf left(lcase(strURL),5)="href=" Then
5. sURL = 1
6. Else sURL = 0
7. End If

Else
objFM.Add Item,Request.QueryString(Item)
End If
Next
End Function

sgietz

7:54 pm on May 22, 2008 (gmt 0)

10+ Year Member



If Not InStr(strURL, "http://") = 0 Or Not InStr(strURL, "href=") = 0 Then
sUrl = 1
Else
sUrl = 0
End If