3 Replies Latest reply on Jul 9, 2006 1:55 PM by Newsgroup_User

    Form inserting but not posting

    Stunna
      I have a simple insert record behavior and after it inserts the record to the database it re-directs to a confirmation page.
      On the confirmation page i am trying to pull the users email from the previous page but the insert page is not Posting the information.

      Here is the code from the insert page:

      <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
      <!--#include file="../Connections/silverlakechurch.asp" -->
      <%
      Dim MM_editAction
      MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
      If (Request.QueryString <> "") Then
      MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
      End If

      ' boolean to abort record edit
      Dim MM_abortEdit
      MM_abortEdit = false
      %>
      <%
      ' IIf implementation
      Function MM_IIf(condition, ifTrue, ifFalse)
      If condition = "" Then
      MM_IIf = ifFalse
      Else
      MM_IIf = ifTrue
      End If
      End Function
      %>
      <%
      If (CStr(Request("MM_insert")) = "form1") Then
      If (Not MM_abortEdit) Then
      ' execute the insert
      Dim MM_editCmd

      Set MM_editCmd = Server.CreateObject ("ADODB.Command")
      MM_editCmd.ActiveConnection = MM_silverlakechurch_STRING
      MM_editCmd.CommandText = "INSERT INTO SilverlakeEmailList (emailfirstname, emaillastname, emailaddress) VALUES (?, ?, ?)"
      MM_editCmd.Prepared = true
      MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 50, Request.Form("emailfirstname")) ' adVarWChar
      MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 50, Request.Form("emaillastname")) ' adVarWChar
      MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 50, Request.Form("emailaddress")) ' adVarWChar
      MM_editCmd.Execute
      MM_editCmd.ActiveConnection.Close

      ' append the query string to the redirect URL
      Dim MM_editRedirectUrl
      MM_editRedirectUrl = "emaillistsendmail.asp"
      If (Request.QueryString <> "") Then
      If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
      Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
      End If
      End If
      Response.Redirect(MM_editRedirectUrl)
      End If
      End If
      %>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns=" http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <title>Untitled Document</title>
      </head>

      <body>
      <form method="POST" action="<%=MM_editAction%>" name="form1">
      <table align="center">
      <tr valign="baseline">
      <td nowrap align="right">Emailfirstname:</td>
      <td><input type="text" name="emailfirstname" value="" size="32"> </td>
      </tr>
      <tr valign="baseline">
      <td nowrap align="right">Emaillastname:</td>
      <td><input type="text" name="emaillastname" value="" size="32"> </td>
      </tr>
      <tr valign="baseline">
      <td nowrap align="right">Emailaddress:</td>
      <td><input type="text" name="emailaddress" value="" size="32"> </td>
      </tr>
      <tr valign="baseline">
      <td nowrap align="right"> </td>
      <td><input type="submit" value="Insert record"> </td>
      </tr>
      </table>
      <input type="hidden" name="MM_insert" value="form1">
      </form>
      <p> </p>
      </body>
      </html>
        • 1. Re: Form inserting but not posting
          jamh51
          Your code would be easier to read if you indented...just a suggestion.
          • 2. Re: Form inserting but not posting
            Level 7
            Stunna,

            I don't understand. Is the input form not inputting the data into the
            database at all, or are you not able to pass the informtion on to another
            form?

            Kirk

            "Stunna" <webforumsuser@macromedia.com> wrote in message
            news:e8rjar$kub$1@forums.macromedia.com...
            >I have a simple insert record behavior and after it inserts the record to
            >the
            > database it re-directs to a confirmation page.
            > On the confirmation page i am trying to pull the users email from the
            > previous
            > page but the insert page is not Posting the information.
            >
            > Here is the code from the insert page:
            >

            • 3. Form inserting but not posting
              DLoe Level 1
              The form is posted to the current form page. The Dreamweaver ASP handles it, inserts the record, and then response.redirects to the confirmation page. The form is never posted to the confirmation page.

              You can put the e-mail address in a session variable, which persists across pages...if the user accepts cookies. Put this at the top of the form page.

              <%
              Session("sesFormEmail")=request.form("emailaddress")
              %>

              If no form is submitted, the session variable will just be NULL. I don't think it will fail. Use an if statment around the above if it fails.

              On the confirmation page, use the session variable like other variables.

              <%
              Response.write(Session("sesFormEmail"))
              %>

              I hope all my syntax on all that is correct. I haven't debugged for typos, etc.