Web Design & Development |
| |

| | Thread Tools |
|
11-Jan-2008, 04:26 AM
#1 |
| Text Area to MySQL Problem 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 %> <html> <form METHOD="POST" action="--WEBBOT-SELF--" language="JavaScript" name="FrontPage_Form1" onsubmit="return FrontPage_Form1_Validator(this)"> <!--webbot bot="SaveDatabase" SuggestedExt="asp" S-DataConnection="SBZ-MySQL" S-RecordSource="participantreviews" S-Form-Fields="EmailAddress ParticipantID ScoreFoodTaste ScoreFoodQuality ScoreValue ScoreService ScoreAtmosphere Reviewer Title Statement Review" S-Form-DBFields="EmailAddress ParticipantID ScoreFoodTaste ScoreFoodQuality ScoreValue ScoreService ScoreAtmosphere Reviewer Title Statement Review" U-ASP-Include-Url="_fpclass/fpdbform.inc" startspan U-Confirmation-Url="subscribers/thankyou-review.asp" U-Validation-Error-Url="subscribers/sorry-review.asp" S-Builtin-Fields="HTTP_USER_AGENT Timestamp" S-Builtin-DBFields="IPAddress Date" --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--#include file="_fpclass/fpdbform.inc"--><!--webbot bot="SaveDatabase" endspan i-checksum="40548" --> <table border="0" width="100%" cellspacing="0" cellpadding="0" id="table76"> <tr> <td width="85%" colspan="2"><font face="Verdana"> <font size="2">Your E-mail Address:<br> (optional, will not appear on site, but will be used to provide you an entry to our gift certificate drawings):<br> </font> <input type="text" name="EmailAddress" size="46" tabindex="1"></font></td> </tr> <tr> <td width="53%"> </td> <td width="47%"> </td> </tr> <tr> <td width="100%" colspan="2"><font face="Verdana" size="2"> Establishment:</font><font face="Verdana"><br> <select size="1" name="ParticipantID" tabindex="3" style="font-size: 8pt; font-family: Verdana"> <% 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("<option value="&replace(SBZRs.fields("Participant_id")," ","")&">"& SBZRs.fields("Participant_name") & "</option>") SBZRs.MoveNext loop SBZRs.Close Set SBZRs = Nothing %> </select></font></td> </tr> <tr> <td width="53%"> </td> <td width="47%"> </td> </tr> <tr> <td width="53%"><b><font face="Verdana" size="2"> Ratings:</font></b></td> <td width="47%"> </td> </tr> <tr> <td width="53%"><font face="Verdana" size="2">Taste of Food:</font></td> <td width="47%"><font face="Verdana"> <select size="1" name="ScoreFoodTaste" tabindex="3"> <option selected value=" ">---</option> <option value="5">5</option> <option value="4">4</option> <option value="3">3</option> <option value="2">2</option> <option value="1">1</option> </select></font></td> </tr> <tr> <td width="53%"><font face="Verdana" size="2">Quality of Food:</font></td> <td width="47%"><font face="Verdana"> <select size="1" name="ScoreFoodQuality" tabindex="4"> <option selected>---</option> <option value="5">5</option> <option value="4">4</option> <option value="3">3</option> <option value="2">2</option> <option value="1">1</option> </select></font></td> </tr> <tr> <td width="53%"><font face="Verdana" size="2">Value Received for Price Paid:</font></td> <td width="47%"><font face="Verdana"> <select size="1" name="ScoreValue" tabindex="5"> <option selected>---</option> <option value="5">5</option> <option value="4">4</option> <option value="3">3</option> <option value="2">2</option> <option value="1">1</option> </select></font></td> </tr> <tr> <td width="53%"><font face="Verdana" size="2">Service:</font></td> <td width="47%"><font face="Verdana"> <select size="1" name="ScoreService" tabindex="6"> <option selected>---</option> <option value="5">5</option> <option value="4">4</option> <option value="3">3</option> <option value="2">2</option> <option value="1">1</option> </select></font></td> </tr> <tr> <td width="53%"><font face="Verdana" size="2"> Atmosphere:</font></td> <td width="47%"><font face="Verdana"> <select size="1" name="ScoreAtmosphere" tabindex="7"> <option selected>---</option> <option value="5">5</option> <option value="4">4</option> <option value="3">3</option> <option value="2">2</option> <option value="1">1</option> </select></font></td> </tr> <tr> <td width="53%"> </td> <td width="47%"> </td> </tr> <tr> <td colspan="2"><font face="Verdana"><font size="2">Name to Appear with Review (optional):<br> </font> <input type="text" name="Reviewer" size="46" tabindex="8"></font></td> </tr> <tr> <td colspan="2"><font face="Verdana"><font size="2"> Title of Your Review:<br> </font> <input type="text" name="Title" size="46" tabindex="9"></font></td> </tr> <tr> <td colspan="2"><font size="2" face="Verdana"> Write Your Review:</font></td> </tr> <tr> <td colspan="2"><font face="Verdana"> <!--webbot bot="Validation" i-maximum-length="25000" --><textarea name="Review" cols="44" rows="10" id="Review" tabindex="11"></textarea></font></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td colspan="2"> <font face="Verdana"> <input type="checkbox" name="Statement" value="ON" checked tabindex="11"><font face="Verdana" style="font-size: 8pt">I have read and agree to SpecialsByZip.com's review policy.</font></td> </tr> </table> <input type="submit" value="Submit" name="Submit" tabindex="13" style="font-family: Verdana; font-size: 10pt"></form |
![]() |

| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |

| Thread Tools | |
| |
| You Are Using: |
Advertisements do not imply our endorsement of that product or service. All times are GMT -4. The time now is 08:53 PM. Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved. Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd. Search Engine Optimization by vBSEO 3.1.0 | |




