# Text Area to MySQL Problem



## mfrankel (Jan 11, 2008)

I'm having a problem with a new form. The form is written in ASP and sends data to a MySQL db. The form always takes the user to the correct thank you page, but only transmits data to the DB when the text area field (there's only one in the form) is left blank. If anything is entered in the text area, the data does not transmit.

Any help would be appreciated!

Here's the code:

<%
On Error Resume Next
Session("FP_OldCodePage") = Session.CodePage
Session("FP_OldLCID") = Session.LCID
Session.CodePage = 1252
Err.Clear

strErrorUrl = "subscribers/sorry-review.asp"

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
Err.Clear

Set fp_conn = Server.CreateObject("ADODB.Connection")
FP_DumpError strErrorUrl, "Cannot create connection"

Set fp_rs = Server.CreateObject("ADODB.Recordset")
FP_DumpError strErrorUrl, "Cannot create record set"

fp_conn.Open Application("SBZ-MySQL_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"

fp_rs.Open "participantreviews", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable
FP_DumpError strErrorUrl, "Cannot open record set"

fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(11)
Dim arFormDBFields0(11)
Dim arFormValues0(11)

arFormFields0(0) = "EmailAddress"
arFormDBFields0(0) = "EmailAddress"
arFormValues0(0) = Request("EmailAddress")
arFormFields0(1) = "ParticipantID"
arFormDBFields0(1) = "ParticipantID"
arFormValues0(1) = Request("ParticipantID")
arFormFields0(2) = "ScoreFoodTaste"
arFormDBFields0(2) = "ScoreFoodTaste"
arFormValues0(2) = Request("ScoreFoodTaste")
arFormFields0(3) = "ScoreFoodQuality"
arFormDBFields0(3) = "ScoreFoodQuality"
arFormValues0(3) = Request("ScoreFoodQuality")
arFormFields0(4) = "ScoreValue"
arFormDBFields0(4) = "ScoreValue"
arFormValues0(4) = Request("ScoreValue")
arFormFields0(5) = "ScoreService"
arFormDBFields0(5) = "ScoreService"
arFormValues0(5) = Request("ScoreService")
arFormFields0(6) = "ScoreAtmosphere"
arFormDBFields0(6) = "ScoreAtmosphere"
arFormValues0(6) = Request("ScoreAtmosphere")
arFormFields0(7) = "Reviewer"
arFormDBFields0(7) = "Reviewer"
arFormValues0(7) = Request("Reviewer")
arFormFields0(8) = "Title"
arFormDBFields0(8) = "Title"
arFormValues0(8) = Request("Title")
arFormFields0(9) = "Statement"
arFormDBFields0(9) = "Statement"
arFormValues0(9) = Request("Statement")
arFormFields0(10) = "Review"
arFormDBFields0(10) = "Review"
arFormValues0(10) = Request("Review")

FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0

If Request.ServerVariables("HTTP_USER_AGENT") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("HTTP_USER_AGENT"), "IPAddress"
End If
FP_SaveFieldToDB fp_rs, Now, "Date"

fp_rs.Update
FP_DumpError strErrorUrl, "Cannot update the database"

fp_rs.Close
fp_conn.Close

Session("FP_SavedFields")=arFormFields0
Session("FP_SavedValues")=arFormValues0
Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")
Response.Redirect "subscribers/thankyou-review.asp"

End If
End If

Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")

%>
<%

Dim myConnection
dim strConnection
dim ServerName
dim UserName
dim UserPassword
dim DatabaseName

'=================Change Credentials Here Below==============================

CREDENTIALS HERE

'=================Change Credentials Here Above==============================

Set myConnection=Server.CreateObject("ADODB.Connection")

strConnection = "Driver=MySQL ODBC 3.51 Driver;" & _
"server=" & ServerName & ";" & _
"user id=" & UserName & ";" & _
"password=" & UserPassword & ";" & _
"database=" & DatabaseName & ";" & _
"Option=3;"

myConnection.ConnectionString=strConnection

myConnection.Open

%>





Your E-mail Address:
(optional, will not appear on 
site, but will be used to provide you an entry to our 
gift certificate drawings):

   
Establishment:

<%

Set SBZRs = Server.CreateObject("ADODB.Recordset")
SBZRs.ActiveConnection = myConnection
SBZRs.CursorType = adOpenStatic
SBZsqlstring = "Select * from specialsbyzip.participant order by participant_name asc"
SBZRs.Open SBZsqlstring

do until SBZRs.EOF
response.Write(""& SBZRs.fields("Participant_name") & "")
SBZRs.MoveNext 
loop

SBZRs.Close
Set SBZRs = Nothing
%>

   *
Ratings:* Taste of 
Food:

---
5
4
3
2
1
Quality of 
Food:

---
5
4
3
2
1
Value 
Received for Price Paid:

---
5
4
3
2
1
Service:

---
5
4
3
2
1

Atmosphere:

---
5
4
3
2
1
  Name 
to Appear with Review (optional):

 
Title of Your Review:

 
Write Your Review: 
   

I 
have read and agree to SpecialsByZip.com's review policy. 
</form


----------

