Forums
This topic is locked
Insert Record NEED HELP!!!
Posted 21 Aug 2001 14:01:32
1
has voted
21 Aug 2001 14:01:32 Jason Chandler posted:
Hi peepsI am using the insert record behaviour on a user sign up page. the insert record works fine, but i need the page that the user is redirected to, to be able to display the information that they filled out in the form..
Any help on how to do this
Thanks peeps...
Replies
Replied 21 Aug 2001 15:35:26
21 Aug 2001 15:35:26 Joel Martinez replied:
I don't know if there's an extension for this, but just find the code for the insert... and add this after it<pre id=code><font face=courier size=2 id=code><%
response.redirect("afterInsert.asp"
%></font id=code></pre id=code>
Joel Martinez
----------
set rs = conn.execute("SELECT answer FROM brain WHERE question = "& forumPost &"
response.redirect("afterInsert.asp"
%></font id=code></pre id=code>
Joel Martinez
----------
set rs = conn.execute("SELECT answer FROM brain WHERE question = "& forumPost &"
Replied 21 Aug 2001 15:52:51
21 Aug 2001 15:52:51 Jason Chandler replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
I don't know if there's an extension for this, but just find the code for the insert... and add this after it<pre id=code><font face=courier size=2 id=code><%
response.redirect("afterInsert.asp"
%></font id=code></pre id=code>
Joel Martinez
----------
set rs = conn.execute("SELECT answer FROM brain WHERE question = "& forumPost &"
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Thanks for replying, This may sound dumb to you but where exactly to i put the code you have supplied..
The code is
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/conCustomers.asp" -->
<%
' *** Edit Operations: declare variables
MM_editAction = CStr(Request("URL")
If (Request.QueryString <> "" Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert") <> "" Then
MM_editConnection = MM_conCustomers_STRING
MM_editTable = "CUSTOMER"
MM_editRedirectUrl = "client_print.asp"
MM_fieldsStr = "contact_Name|value|contact_Name2|value|contact_Name3|value|contact_Name4|value|contact_Name5|value|contact_Name6|value|Company|value|Address1|value|DateIn|value|Address2|value|account_exec|value|county|value|city|value|Delivery|value|postcode|value|cod|value|Telephone|value|comments|value|Fax|value|Email|value|Web|value|account_info|value"
MM_columnsStr = "CONTACT1|',none,''|CONTACT2|',none,''|CONTACT3|',none,''|CONTACT4|',none,''|CONTACT5|',none,''|CONTACT6|',none,''|COMPANY|',none,''|ADDRESS1|',none,''|CREATED|#,none,NULL|ADDRESS2|',none,''|ACEXEC|',none,''|COUNTY|',none,''|CITY|',none,''|DELIVMETH|',none,''|POSTCODE|',none,''|COD|none,1,0|TELEPHONE|',none,''|COMMENTS|',none,''|FAX|',none,''|EMAIL|',none,''|WEB|',none,''|ACCOUNTINFO|',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|"
MM_columns = Split(MM_columnsStr, "|"
' set the form values
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "" Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "" Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
If (CStr(Request("MM_insert") <> "" Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
FormVal = MM_fields(i+1)
MM_typeArray = Split(MM_columns(i+1),","
Delim = MM_typeArray(0)
If (Delim = "none" Then Delim = ""
AltVal = MM_typeArray(1)
If (AltVal = "none" Then AltVal = ""
EmptyVal = MM_typeArray(2)
If (EmptyVal = "none" Then EmptyVal = ""
If (FormVal = "" Then
FormVal = EmptyVal
Else
If (AltVal <> "" Then
FormVal = AltVal
ElseIf (Delim = "'" Then ' escape quotes
FormVal = "'" & Replace(FormVal,"'","''" & "'"
Else
FormVal = Delim + FormVal + Delim
End If
End If
If (i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End if
MM_tableValues = MM_tableValues & MM_columns(i)
MM_dbValues = MM_dbValues & FormVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & " values (" & MM_dbValues & ""
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command"
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "" Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
I would appericate it if you could mark where i should put it as i think there is already an redirect statement and im confused
Thanks
I don't know if there's an extension for this, but just find the code for the insert... and add this after it<pre id=code><font face=courier size=2 id=code><%
response.redirect("afterInsert.asp"
%></font id=code></pre id=code>
Joel Martinez
----------
set rs = conn.execute("SELECT answer FROM brain WHERE question = "& forumPost &"
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Thanks for replying, This may sound dumb to you but where exactly to i put the code you have supplied..
The code is
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/conCustomers.asp" -->
<%
' *** Edit Operations: declare variables
MM_editAction = CStr(Request("URL")
If (Request.QueryString <> "" Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert") <> "" Then
MM_editConnection = MM_conCustomers_STRING
MM_editTable = "CUSTOMER"
MM_editRedirectUrl = "client_print.asp"
MM_fieldsStr = "contact_Name|value|contact_Name2|value|contact_Name3|value|contact_Name4|value|contact_Name5|value|contact_Name6|value|Company|value|Address1|value|DateIn|value|Address2|value|account_exec|value|county|value|city|value|Delivery|value|postcode|value|cod|value|Telephone|value|comments|value|Fax|value|Email|value|Web|value|account_info|value"
MM_columnsStr = "CONTACT1|',none,''|CONTACT2|',none,''|CONTACT3|',none,''|CONTACT4|',none,''|CONTACT5|',none,''|CONTACT6|',none,''|COMPANY|',none,''|ADDRESS1|',none,''|CREATED|#,none,NULL|ADDRESS2|',none,''|ACEXEC|',none,''|COUNTY|',none,''|CITY|',none,''|DELIVMETH|',none,''|POSTCODE|',none,''|COD|none,1,0|TELEPHONE|',none,''|COMMENTS|',none,''|FAX|',none,''|EMAIL|',none,''|WEB|',none,''|ACCOUNTINFO|',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|"
MM_columns = Split(MM_columnsStr, "|"
' set the form values
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "" Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "" Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
If (CStr(Request("MM_insert") <> "" Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
FormVal = MM_fields(i+1)
MM_typeArray = Split(MM_columns(i+1),","
Delim = MM_typeArray(0)
If (Delim = "none" Then Delim = ""
AltVal = MM_typeArray(1)
If (AltVal = "none" Then AltVal = ""
EmptyVal = MM_typeArray(2)
If (EmptyVal = "none" Then EmptyVal = ""
If (FormVal = "" Then
FormVal = EmptyVal
Else
If (AltVal <> "" Then
FormVal = AltVal
ElseIf (Delim = "'" Then ' escape quotes
FormVal = "'" & Replace(FormVal,"'","''" & "'"
Else
FormVal = Delim + FormVal + Delim
End If
End If
If (i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End if
MM_tableValues = MM_tableValues & MM_columns(i)
MM_dbValues = MM_dbValues & FormVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & " values (" & MM_dbValues & ""
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command"
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "" Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
I would appericate it if you could mark where i should put it as i think there is already an redirect statement and im confused
Thanks
Replied 21 Aug 2001 19:06:03
21 Aug 2001 19:06:03 Joel Martinez replied:
hmm, after looking at that code, it seems that it's already redirecting somewhere... "client_print.asp"
if you find this chunk of code, then you should be able to change that URL, and get the result you want...
<pre id=code><font face=courier size=2 id=code>MM_editConnection = MM_conCustomers_STRING
MM_editTable = "CUSTOMER"
<b>MM_editRedirectUrl = "client_print.asp"</b>
MM_fieldsStr = "contact_Name|value|contact_Name2|value|contact_Name3|value|contact_Name4|value|contact_Name5|value|contact_Name6|value|Company|value|Address1|value|DateIn|value|Address2|value|account_exec|value|county|value|city|value|Delivery|value|postcode|value|cod|value|Telephone|value|comments|value|Fax|value|Email|value|Web|value|account_info|value"
MM_columnsStr = "CONTACT1|',none,''|CONTACT2|',none,''|CONTACT3|',none,''|CONTACT4|',none,''|CONTACT5|',none,''|CONTACT6|',none,''|COMPANY|',none,''|ADDRESS1|',none,''|CREATED|#,none,NULL|ADDRESS2|',none,''|ACEXEC|',none,''|COUNTY|',none,''|CITY|',none,''|DELIVMETH|',none,''|POSTCODE|',none,''|COD|none,1,0|TELEPHONE|',none,''|COMMENTS|',none,''|FAX|',none,''|EMAIL|',none,''|WEB|',none,''|ACCOUNTINFO|',none,''"
' create the MM_
</font id=code></pre id=code>
Joel Martinez [ ]
----------
set rs = conn.execute("SELECT answer FROM brain WHERE question = "& forumPost &"
'2nd place is just 1st Loser
if you find this chunk of code, then you should be able to change that URL, and get the result you want...
<pre id=code><font face=courier size=2 id=code>MM_editConnection = MM_conCustomers_STRING
MM_editTable = "CUSTOMER"
<b>MM_editRedirectUrl = "client_print.asp"</b>
MM_fieldsStr = "contact_Name|value|contact_Name2|value|contact_Name3|value|contact_Name4|value|contact_Name5|value|contact_Name6|value|Company|value|Address1|value|DateIn|value|Address2|value|account_exec|value|county|value|city|value|Delivery|value|postcode|value|cod|value|Telephone|value|comments|value|Fax|value|Email|value|Web|value|account_info|value"
MM_columnsStr = "CONTACT1|',none,''|CONTACT2|',none,''|CONTACT3|',none,''|CONTACT4|',none,''|CONTACT5|',none,''|CONTACT6|',none,''|COMPANY|',none,''|ADDRESS1|',none,''|CREATED|#,none,NULL|ADDRESS2|',none,''|ACEXEC|',none,''|COUNTY|',none,''|CITY|',none,''|DELIVMETH|',none,''|POSTCODE|',none,''|COD|none,1,0|TELEPHONE|',none,''|COMMENTS|',none,''|FAX|',none,''|EMAIL|',none,''|WEB|',none,''|ACCOUNTINFO|',none,''"
' create the MM_
</font id=code></pre id=code>
Joel Martinez [ ]
----------
set rs = conn.execute("SELECT answer FROM brain WHERE question = "& forumPost &"
'2nd place is just 1st Loser
Replied 21 Aug 2001 19:33:03
21 Aug 2001 19:33:03 Joel Martinez replied:
oh crud...
I just re-read the original post, and I've misRead it... sorry (it was off to the side of the page)
to do that, just build the display form with places for all the data you want to show, then just put this wherever you need (and replace the name with the textbox name)
<pre id=code><font face=courier size=2 id=code><%=request("textboxname"%></font id=code></pre id=code>That will show everything that was passed into the database.
again sorry bout that <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Joel Martinez [ ]
----------
set rs = conn.execute("SELECT answer FROM brain WHERE question = "& forumPost &"
'2nd place is just 1st Loser
I just re-read the original post, and I've misRead it... sorry (it was off to the side of the page)
to do that, just build the display form with places for all the data you want to show, then just put this wherever you need (and replace the name with the textbox name)
<pre id=code><font face=courier size=2 id=code><%=request("textboxname"%></font id=code></pre id=code>That will show everything that was passed into the database.
again sorry bout that <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Joel Martinez [ ]
----------
set rs = conn.execute("SELECT answer FROM brain WHERE question = "& forumPost &"
'2nd place is just 1st Loser
Replied 22 Aug 2001 10:02:34
22 Aug 2001 10:02:34 Jason Chandler replied:
Thanks For your Replys dude..
I to thought that using <%=request("textboxname"%> would work but it wont work at all. It seems to me that if you use the macromedia Insert record Live object or the behaviour you can not request the form values once you reach the redirect page...
Do you have any more ideas dude... as i need this to work.
Thanks for your help
Edited by - jason123 on 08/22/2001 10:03:56
I to thought that using <%=request("textboxname"%> would work but it wont work at all. It seems to me that if you use the macromedia Insert record Live object or the behaviour you can not request the form values once you reach the redirect page...
Do you have any more ideas dude... as i need this to work.
Thanks for your help
Edited by - jason123 on 08/22/2001 10:03:56
Replied 22 Aug 2001 14:51:16
22 Aug 2001 14:51:16 Andrew Watson replied:
I think UDNewbie had a tutorial on how to display the info entered in a registration form on a 'confirm' page. These tutorials are excellent and very easy to follow, a great starting point for developing apps.
Cheers
Andrew Watson
Cheers
Andrew Watson