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

Passing variables (URGENT)

Status
Not open for further replies.

NeoTurtle

Programmer
Aug 25, 2000
38
0
0
US
Hi. I'm having trouble passing a variables. This is what I'm doing:

newacct1.asp
login page passing form values with post method

newacct2.asp
checks our DB for Agreement = 0 or 1
if 0 go to agreement.asp
else go to newacct3.asp
currently doesn't check password, another problem i'll have to deal with after this.

<%@ LANGUAGE=&quot;VBScript&quot; %>
<!-- #include file = &quot;wli.inc&quot; -->
<%
SET NewID = Request.Form(&quot;LoginID&quot;)
set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
objConn.Open strConnection
Set LoginRS = Server.CreateObject(&quot;ADODB.Recordset&quot;)
SQL = &quot;SELECT * FROM tbl WHERE (BillID = '&quot; & NewID & &quot;')&quot;
LoginRS.Open SQL, objConn, 1

If Trim(LoginRS(&quot;Agree&quot;)) = 1 Then
Response.Write &quot;<FORM METHOD='post' ACTION='newacct3.asp'>&quot;
Response.Write &quot;<INPUT TYPE='Hidden' NAME='LoginID' VALUE='&quot; & Trim(&quot;BillID&quot;) & &quot;'>&quot;
Response.Write &quot;</FORM>&quot;
Response.Redirect &quot;newacct3.asp&quot;
Else
Response.Redirect &quot;agreement.asp&quot;
End If
%>

error:
Response object error 'ASP 0156 : 80004005'

Header Error

/testsite/newacct2.asp, line 15

The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content.


Thanks in advance.
 
I believe that instead of just redirecting to the newacct3 page with this line:
> Response.Redirect &quot;newacct3.asp&quot;

You need to be submitting the form you've just created. You can do this by Response.Write-ing a snippet of javascript like the following:

<SCRIPT>
<!--
form1.submit()
//-->
</SCRIPT>

You'll also need to add a &quot;name=form1&quot; attribute to your <FORM> tag.
 
You do not show where your HTML header / body etc are. Regardless, do this. BEFORE the first HTML statement, do
<%Response.Buffer = True%>
BEFORE Response.Redirect put a
<%Response.Clear%>
 
Thanks a lot for your help guys. I'm pretty new to ASP and I hate it sooo much. ColdFusion is so much more clear and uses less coding. I'm just going to do this:

<%@ LANGUAGE=&quot;VBScript&quot; %>
<!-- #include file = &quot;wli.inc&quot; -->
<%
SET NewID = Request.Form(&quot;LoginID&quot;)
set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
objConn.Open strConnection
Set LoginRS = Server.CreateObject(&quot;ADODB.Recordset&quot;)
SQL = &quot;SELECT * FROM tbl WHERE (BillID = '&quot; & NewID & &quot;')&quot;
LoginRS.Open SQL, objConn, 1

If Trim(LoginRS(&quot;Agree&quot;)) = 1 Then
put in the contents of newacct3.asp
Else
put in the contents of agreement.asp
End If
%>
 
Simple...Dont Redirect AFTER writing content to the browser!


Also dont 'SET' your variable 'NewID'. Do this:

Dim NewID
NewID = Request.Form(&quot;LoginID&quot;)


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top