Hello,
I have an edit user page that allows the user to view their user information and make changes if possible. I have a simple html login page that directs to an asp page called edituser.asp when they login. Here is the edituser.asp code I have
In this code, I simply allow the user to edit their "State". When the user registers, they choose a state which is stored in my database. However, when I go to the edituser.asp page, it just shows "Choose State". How do I get the edituser.asp page to show which state they said they were from when they registered?
thanks - Jerry
I have an edit user page that allows the user to view their user information and make changes if possible. I have a simple html login page that directs to an asp page called edituser.asp when they login. Here is the edituser.asp code I have
Code:
<%@ Language=VBScript %>
<% Option Explicit %>
<!--#include virtual="/adovbs.inc"-->
<html>
<body>
<%
Dim oConn, oRs
Dim connectstr, sDSNDir, tablename
Dim db_name, db_username, db_userpassword
Dim dsn_name
dsn_name = "register.dsn"
tablename = "tblRegister"
db_username = "****"
db_userpassword = "****"
sDSNDir = Server.MapPath("/_dsn")
connectstr = "filedsn=" & sDSNDir & "/" & dsn_name
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr
Dim objRS, bolFound, strEmail
strEmail = Request.Form("email")
If strEmail = "" Then
oConn.Close
Set objConn = Nothing
Response.Write "<a href='login.html'>"
Response.Write "You must enter a email address"
Response.Write "</a>"
Response.End
End If
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "tblRegister", oConn, , , adCmdTable
bolFound = False
Do While Not (objRS.EOF OR bolFound)
If (StrComp(objRS("Email"), strEmail, vbTextCompare) = 0) Then
BolFound = True
Else
objRS.MoveNext
End If
Loop
If Not bolFound Then
objRS.Close
Set objRS = Nothing
oConn.Close
Set oConn = Nothing
Response.Write "<a href='login.html'>"
Response.Write "Invalid Email Address.<p>"
Response.Write "</a>"
Response.End
End If
If Not (StrComp(objRS("Password"), Request.Form("password"), _
vbBinaryCompare) = 0) Then
objRS.Close
Set objRS = Nothing
oConn.Close
Set oConn = Nothing
Response.Write "<a href='login.html'>"
Response.Write "Invalid password.<p>"
Response.Write "</a>"
Response.End
End If
%>
<!-- create form, fill with values from table -->
<form method=post action="modifyuser.asp">
<p>
State: <select name=state type=text value="<%=objRS("State")%>">
<option selected="state">Choose State</option>
<option value="AL">AL</option>
<option value="AR">AR</option>
<option value="AZ">AZ</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
<option value="DC">DC</option>
</select>
<p>
<input type=reset> <input type=submit>
</form>
</body>
</html>
<%
objRS.Close
Set objRS = Nothing
oConn.Close
Set oConn = Nothing
%>
In this code, I simply allow the user to edit their "State". When the user registers, they choose a state which is stored in my database. However, when I go to the edituser.asp page, it just shows "Choose State". How do I get the edituser.asp page to show which state they said they were from when they registered?
thanks - Jerry
Comment