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!

Showing previous page with its original data still on the page

Status
Not open for further replies.

IL

Programmer
Jan 7, 2002
15
SE
Hi there,
New to ASP and have a small assignment.
Login, name and e-mail which must be validated on the server. If there is an error the user should be taken back to the first page to correct the data and then send it again. When the user is brought back to the first page, the data that was originally written should still be there.
Response.Redirect will erase all data. If I use just an ordinary link, and HREF, it also erases all data.
For this assignment I'm not supposed to use a Global.asa.
If I use Session variables, how do I get the data to remain
on the first page, or do I bring it with me back and forth between the pages. How To ??
How can I keep the data ??
IL
 
There are many ways to skin this cat. Two Are:

Session Variables:
==================
Page one posts to the server, to page 2.
Here, assign the info to the session variables ie
session("email") = request.form("email")

then if the info is not correct, redirect to page one, and here you place the session info back into the text boxes ie
<input name=&quot;email&quot; value=&quot;<%=session(&quot;email&quot;)%>&quot;>

If the session variable is empty, the text box will be empty, so no problem the first time a user visits.

Query String:
=============
On the server side, add a querystring you build on the fly. ie
if not valid then
response.redirect(&quot;default.asp?email=&quot; & request.form(&quot;email&quot;) & &quot;&name=&quot; & response. .... etc
end if

Then on the client page [1] you would add any querystring info back into the value of the textboxes ie

<input name=&quot;email&quot; value=&quot;<%=request.querystring(&quot;email&quot;)%>&quot;>

Cookies are a third.
Jonathan Galpin
 
Hi
Thank you for your reply, however that which you mentioned is precisely my question.
How do I get the variables from page 2 back to page 1.
If you use VALUE=&quot;<%=Session(&quot;EMail&quot;)%>&quot; it will show up in the textbox exactly what you write VALUE to be, like here:
&quot;<%=Session(&quot;EMail&quot;)%>&quot;.
Or, have I misunderstood your idea, if so, could you Please show me.
Like what would my first page look like and how would the link back to page 1 from page 2 look like??
Thanks
IL
 
Sessions are sotored while the browser is open, for anything longer lasting you'd need to use cookies.
Or you can pass those variables back in a query string:

wen redirecting, add the values to the URL

response.redirect &quot;login.asp?username=&quot; & USERNAME & &quot;&password=&quot; & PASSWORD


then back on the login page just chage your input boxes to something like this:

<input type=&quot;text&quot; name=&quot;usrename&quot; value=&quot;<%=Request.QueryString(&quot;username&quot;)%>&quot;>

This way it will stay there in case the user is redirected.
 
Hello again,
Yes, you're right.
The page has to be an .asp.
We were given the task to use a Client.htm and
a server.asp.
After doing a lot of thinking I finally decided to
rename the client page to an .asp form and it worked.
I believe the html cannot handle variables.
Thank you all for your help.
IL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top