Need a little help
The problem that I am having with this part of the chapter 15 program is after I have logged in with a user name and I am at the âmenu for registered usersâ. If I click on the link âEdit Registrationâ when it takes me to the Register.asp it doesnât open the logged in userâs record for edit. It openes the the last recorded added.
What code do I need to open the current record for editing? I have changed the original code and created a new database can you see where I went wrong? Most things work so far I am just not sure how to edit the current user.
Thanks
Mike Drumm
MenuForRegisteredUsers.ASP
<%
If Session("PersonID") = "" Then
Response.Redirect "Login.asp"
End If
%>
<BASEFONT FACE="Comic Sans MS" COLOR="DarkBlue">
<HTML>
<HEAD>
<TITLE>Wrox Classifieds</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFF80">
<CENTER><H1> Wrox Classifieds <BR>Registered Users' Menu</H1>
<H3>Welcome <%= Session("FirstName") %></H1>
</CENTER><P>
Thank you for visiting this site. We offer many opportunities :
<UL>
<LI>Browse
<LI>Check available dates & times
<LI>Book an appointment
</UL>
<TABLE BORDER=0 WIDTH=100%>
<TR ALIGN=CENTER>
<TD WIDTH=33%><A HREF="BrowseListings.asp">Browse </A></TD>
<TD WIDTH=33%><A HREF="Register.asp?Update=True">Edit Registration Info</A></TD>
</TR>
</TABLE>
</BODY>
</HTML>
Register.asp
<BASEFONT FACE="Comic Sans MS" COLOR="DarkBlue">
<HTML>
<HEAD>
<SCRIPT language="JavaScript">
<!--
function VerifyData()
{
if (document.frmUser.Password.value != document.frmUser.VerifyPassword.value)
{
alert ("Your passwords do not match - please reenter");
return false;
}
else
return true;
}
-->
</SCRIPT>
<TITLE>Wrox Classifieds - User Registration</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFF80">
<CENTER>
<%
If Request("Update") = "True" Then
Response.Write "<H1> Wrox Classifieds <BR> Update User Registration</H1>"
Else
Response.Write "<H1> Wrox Classifieds <BR> New User Registration</H1>"
End If
%>
</CENTER>
<P>
<%
If Request("Update") = "True" Then
Response.Write "Please change your registration information as listed below<P>"
Else
If Request("NotFound") = "True" Then
Response.Write "<I>We were unable to locate your information. " & _
"Please take the time to register again.</I><P>"
Else
Response.Write "<CENTER>(If you're already registered with us, " & _
"then click the 'Login' link below.)</CENTER><P>"
End If
Response.Write "You only need to register with our system if you want to " & _
"bid on existing 'for-sale' items, or sell your own items " & _
"on these pages. <BR> " & _
"In order to use these services, please take a few minutes " & _
"to complete the form below. Once you have done that, " & _
"you will have full access to the system."
End If
%>
<FORM ACTION="AddUser.asp" NAME="frmUser" METHOD="POST"
onSubmit="return VerifyData()">
<TABLE BORDER=0>
<TR>
<TD WIDTH=20% ROWSPAN=11> </TD>
<TD>E-Mail Address:</TD>
<TD><INPUT TYPE="Text" NAME="email" VALUE="<%= Session("email")%>"
SIZE="40"></TD>
</TR>
<TR>
<TD>Given Name:</TD>
<TD><INPUT TYPE="Text" NAME="FirstName" VALUE="<%= Session("FirstName")%>"
SIZE="40"></TD>
</TR>
<TR>
<TD>Family Name:</TD>
<TD><INPUT TYPE="Text" NAME="LastName" VALUE="<%= Session("LastName")%>"
SIZE="40"></TD>
</TR>
<TR>
<TD>Address:</TD>
<TD><INPUT TYPE="Text" NAME="Address1" VALUE="<%= Session("Address1")%>"
SIZE="40"></TD>
</TR>
<TR>
<TD></TD>
<TD><INPUT TYPE="Text" NAME="Address2" VALUE="<%= Session("Address2")%>"
SIZE="40"></TD>
</TR>
<TR>
<TD>City:</TD>
<TD><INPUT TYPE="Text" NAME="City" VALUE="<%= Session("City")%>"
SIZE="40"></TD>
</TR>
<TR>
<TD>State:</TD>
<TD><INPUT TYPE="Text" NAME="State" VALUE="<%= Session("State")%>"
SIZE="40"></TD>
</TR>
<TR>
<TD>Postal Code:</TD>
<TD><INPUT TYPE="Text" NAME="Zip" VALUE="<%= Session("Zip")%>"
SIZE="40"></TD>
</TR></TR>
<TR>
<TD> <P>Password:</TD>
<TD VALIGN=bottom><INPUT TYPE="Password" NAME="Password"
VALUE="<%= Session("Password") %>" SIZE="40"></TD>
</TR>
<TR>
<TD>Verify Password:</TD>
<TD><INPUT TYPE="Password" NAME="VerifyPassword" SIZE="40"></TD>
</TR>
<TR>
<TD></TD>
<TD ALIGN=CENTER COLSPAN=2><BR>
<INPUT TYPE="Submit" VALUE="Submit Registration">
<INPUT TYPE="RESET"></TD>
</TR>
</TABLE>
</FORM>
<TABLE BORDER=0 WIDTH=100%>
<TR ALIGN=CENTER>
<TD WIDTH=33%><A HREF="BrowseListings.asp">Browse the listings</A></TD>
<TD WIDTH=33%><A HREF="Login.asp">Login</A></TD>
<TD WIDTH=33%>I'm a new user</TD>
</TR>
</TABLE>
</BODY>
</HTML>
|