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

Redirect with query string attached!!!!!!!

Status
Not open for further replies.

jwithers

Programmer
Nov 28, 2001
1
GB
I am new this programming lark and need help....

I am constructing a password page and need to redirect to a page with a querystring attached to the URL, the URL is being made correctly but not passing to the next page,

The password comparision code is below:-
<%
set conn=Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.Open &quot;staff_tasks&quot;
set rs = Server.CreateObject(&quot;ADODB.recordset&quot;)

mysql= &quot;Select uid, password, name FROM access WHERE uid = &quot; & chr(39) & request.Form(&quot;login&quot;) & chr(39)
rs.Open mysql, conn
IF not rs.EOF then
If Request.Form(&quot;password&quot;) = rs (&quot;password&quot;) Then
url=&quot;it_tasks_frameset.htm?username=&quot; & rs(&quot;name&quot;)
Response.redirect (url)
End if
Else
response.Write(&quot;Access Denied!&quot;)
End IF
%>


The start of the page that should take the string is below:-
<%
sname = request.querystring(&quot;username&quot;)
%>
<input type=&quot;hidden&quot; name=&quot;name&quot; value=&quot;<%=sname%>&quot;>

For some strange reason the string is not being passed to the next page, is there something that I am missing????

 
Try this :

Code:
<%
    set conn=Server.CreateObject(&quot;ADODB.Connection&quot;)
    conn.Open &quot;staff_tasks&quot;
    set rs = Server.CreateObject(&quot;ADODB.recordset&quot;)

    mysql= &quot;Select uid, password, name FROM access WHERE uid = &quot; & chr(39) & request.Form(&quot;login&quot;) & chr(39)
    rs.Open mysql, conn
    IF not rs.EOF then
        If Request.Form(&quot;password&quot;) = rs (&quot;password&quot;) Then
            Response.redirect &quot;it_tasks_frameset.htm?username=&quot; & rs(&quot;name&quot;)
        End if
    Else
        response.Write(&quot;Access Denied!&quot;)
    End IF
%>[code][/color] Regards

Big Dave

davidbyng@hotmail.com


** If I am wrong I am sorry, but i'm only trying to help!! **
 
you're passing the querystring to an HTML page, shouldn't it be ASP?

url=&quot;it_tasks_frameset.htm?username=&quot; & rs(&quot;name&quot;)

should be:

url=&quot;it_tasks_frameset.asp?username=&quot; & rs(&quot;name&quot;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top