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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ChkString error?

Status
Not open for further replies.

SteveHigh

Technical User
Jan 17, 2007
158
GB
Hello

I have an untidy Flash site here:


When the online form is completed, the Webmaster receives the form details and that, at least seems to be working.

I have two asp files which do the work:

<%
Dim fullname,email,subject,country,message

if Request.Form("Submit") <> "" then

fullname = Request.Form("fullname")
email = Request.Form("email")
subject = Request.Form("subject")
country = Request.Form("country")
message = Request.Form("message")

Server.Transfer "welcomeFlash.asp"
End if

%>

The welcomeFlash.asp file is supposed to store the details in a database (but doesn't), and HTML format the email sent to the Webmaster (but doesn't).

I do get an error message in welcomeFlash.asp:

Type mismatch: 'ChkString'

/myFlash/welcomeFlash.asp, line 11


but it does not seem to hinder the email being sent. This is the code I have (copied and pasted from welcomeFlash.asp) and to which the error points:

<%
' Declare variables

Dim fullname, email, subject,country, message

'Get form field values from flashEmailTest file

fullname = ChkString(Request.Form("fullname"))
email = ChkString(Request.Form("email"))
email = ChkString(Request.Form("subject"))
country = ChkString(Request.Form("country"))
message = ChkString(Request.Form("message"))

'Open MS Access database, store form field values, and close

set conn=Server.CreateObject("ADODB.Connection")

conn.Open "driver={Microsoft Access Driver (*.mdb)};DBQ=D:\Flashform.mdb;"
set rs = Server.CreateObject("ADODB.recordset")

SQL="INSERT INTO users (fullname, email, country, message) VALUES ('" & _
fullname & "', '" & email & "','" & subject & "', '" & country & "', '" & message & "')"

rs.Open SQL, conn

Set rs=Nothing

conn.Close
Set conn=Nothing
%>

Is there anything obviously wrong?

Thank you for your time.

Cheers

Steve
 
What is ChkString? Is this a function you have created, if so where is that code?

Nick

where would we be without rhetorical questions...
 
Hello nickdel

Thank you for your post.

I agree that ChkString is not necessary as I have a script already in Flash which checks that the fields have been completed, so I do not need it in my ASP script.

So I need to get the code working, without the ChkString.

This is what I have in asp.1:

<%
Dim fullname,email,subject,country,message

if Request.Form("Submit") <> "" then

fullname = Request.Form("fullname")
email = Request.Form("email")
subject = Request.Form("subject")
country = Request.Form("country")
message = Request.Form("message")

Server.Transfer "welcomeFlash.asp"
End if

%>

I am also not too sure what this (please see above) does:

if Request.Form("Submit") <> "" then

but I suspect it is not necessary. However, I have declared my variables here and presumably they will be sent to welcomeFlash.asp. I take it that I do not need to declare them more than once? That is, I take it that I need only declare them in asp.1 and not, again, in welcomeFlash.asp?

If, then, I removed the Request.Form("Submit") in asp.1 and the ChkString and declaration of variables in welcomeFlash.asp, I would be left with the following:


asp.1:

<%
Dim fullname,email,subject,country,message

fullname = Request.Form("fullname")
email = Request.Form("email")
subject = Request.Form("subject")
country = Request.Form("country")
message = Request.Form("message")

Server.Transfer "welcomeFlash.asp"
End if
%>

and welcomeFlash.asp:


<%

'Open MS Access database, store form field values, and close

set conn=Server.CreateObject("ADODB.Connection")

conn.Open "driver={Microsoft Access Driver (*.mdb)};DBQ=D:\Flashform.mdb;"
set rs = Server.CreateObject("ADODB.recordset")

SQL="INSERT INTO users (fullname, email, subject, country, message) VALUES ('" & _
fullname & "', '" & email & "','" & subject & "', '" & country & "', '" & message & "')"

rs.Open SQL, conn

Set rs=Nothing

conn.Close
Set conn=Nothing
%>

Does that sound right?

Thanks

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top