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

Retrieving values from form on other page

Status
Not open for further replies.

Herminio

Technical User
May 10, 2002
189
PT
This is what i want to do

Imagine that you have a page where you make you registry(not login), when you submit i want you to receive the information about Username and Password just to be shure you don't forget it, i just want to know the way to get the value entered in those fields of the registry page into the congrats page.

Thanks in advance

Herminio, Portugal
 
Hi Herminio,

This goes back to basics.. you simply call the values using the Request.Form or Request methods.. I'll give you a small example below:

<html>
<head>
</head>
<body>
Congradulations! You have now signed up.. Below is your username and passsword for confirmation..
<p>
<div align=&quot;center&quot;><%=request.form(&quot;username&quot;)%>
<br>
<%=request.form(&quot;password&quot;)%>
</div>
</body>
</html>

 
Thanks Gorken, but that example aplies only if the form is in the same page, and that's not what i want to do i have a register.asp that goes like this:

<%@LANGUAGE=&quot;VBSCRIPT&quot;%>
<!--#include file=&quot;../Connections/bd1.asp&quot; -->
<%
' *** Edit Operations: declare variables

MM_editAction = CStr(Request(&quot;URL&quot;))
If (Request.QueryString <> &quot;&quot;) Then
MM_editAction = MM_editAction & &quot;?&quot; & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = &quot;&quot;
%>
<%
' *** Insert Record: set variables

If (CStr(Request(&quot;MM_insert&quot;)) <> &quot;&quot;) Then

MM_editConnection = MM_bd1_STRING
MM_editTable = &quot;Tabela1&quot;
MM_editRedirectUrl = &quot;sucess.asp&quot;
MM_fieldsStr = &quot;user|value|pass|value&quot;
MM_columnsStr = &quot;User|',none,''|Password|',none,''&quot;

' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, &quot;|&quot;)
MM_columns = Split(MM_columnsStr, &quot;|&quot;)

' 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 <> &quot;&quot; And Request.QueryString <> &quot;&quot;) Then
If (InStr(1, MM_editRedirectUrl, &quot;?&quot;, vbTextCompare) = 0 And Request.QueryString <> &quot;&quot;) Then
MM_editRedirectUrl = MM_editRedirectUrl & &quot;?&quot; & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & &quot;&&quot; & Request.QueryString
End If
End If

End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

If (CStr(Request(&quot;MM_insert&quot;)) <> &quot;&quot;) Then

' create the sql insert statement
MM_tableValues = &quot;&quot;
MM_dbValues = &quot;&quot;
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
FormVal = MM_fields(i+1)
MM_typeArray = Split(MM_columns(i+1),&quot;,&quot;)
Delim = MM_typeArray(0)
If (Delim = &quot;none&quot;) Then Delim = &quot;&quot;
AltVal = MM_typeArray(1)
If (AltVal = &quot;none&quot;) Then AltVal = &quot;&quot;
EmptyVal = MM_typeArray(2)
If (EmptyVal = &quot;none&quot;) Then EmptyVal = &quot;&quot;
If (FormVal = &quot;&quot;) Then
FormVal = EmptyVal
Else
If (AltVal <> &quot;&quot;) Then
FormVal = AltVal
ElseIf (Delim = &quot;'&quot;) Then ' escape quotes
FormVal = &quot;'&quot; & Replace(FormVal,&quot;'&quot;,&quot;''&quot;) & &quot;'&quot;
Else
FormVal = Delim + FormVal + Delim
End If
End If
If (i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & &quot;,&quot;
MM_dbValues = MM_dbValues & &quot;,&quot;
End if
MM_tableValues = MM_tableValues & MM_columns(i)
MM_dbValues = MM_dbValues & FormVal
Next
MM_editQuery = &quot;insert into &quot; & MM_editTable & &quot; (&quot; & MM_tableValues & &quot;) values (&quot; & MM_dbValues & &quot;)&quot;

If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject(&quot;ADODB.Command&quot;)
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl <> &quot;&quot;) Then
Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>
<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<p><br>
</p>
<form name=&quot;form1&quot; method=&quot;POST&quot; action=&quot;<%=MM_editAction%>&quot;>
<p>Username:
<input type=&quot;text&quot; name=&quot;user&quot;>
<br>
Password:
<input type=&quot;text&quot; name=&quot;pass&quot;>
</p>
<input type=&quot;hidden&quot; name=&quot;MM_insert&quot; value=&quot;true&quot;>
<input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Submit&quot;>
</form>
<p>&nbsp; </p>
</body>
</html>

and i have a sucess.asp page like this:

<%@LANGUAGE=&quot;VBSCRIPT&quot;%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>
<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>



<table width=&quot;18%&quot; border=&quot;1&quot;>
<tr>
<td width=&quot;12%&quot;>Username:</td>
<td width=&quot;88%&quot;><%=Request.form(&quot;user&quot;)%></td>
</tr>
<tr>
<td width=&quot;12%&quot;>Password:</td>
<td width=&quot;88%&quot;><%=Request.form(&quot;pass&quot;)%></td>
</tr>
</table>
</body>
</html>

this just doesn't work

Can you put hte examples for the two pages here?

Thanks

Herminio, Portugal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top