I have a page where users can amend their personal details, once they have successfully entered their username and password. I want to change this in the sense; when a user enters their username and password, their details appear from the database, and they can change what ever details they want. I want their details to appear in text boxes. Is this possible? If so, how?
Thanks in Advance
This is the code that I am currently using;
Input Form
ASP Code to add to DB
Thanks in Advance
This is the code that I am currently using;
Input Form
Code:
<HTML>
<HEAD>
<TITLE>Amend Details</TITLE>
</HEAD>
<BODY>
<div id="content">
<input type="button" onClick="document.all.content.style.zoom=(document.all.content.style.zoom==1?2:1);" value="ENLARGE TEXT">
<H1><U><B>Amend Details</U></B></H1>
<BR>
<BR>
Have you changed address? If so, you can amend your details here<br>
and give us your new details. <BR>
<BR>
You must enter your username and password in order to change your details.<BR>
<form action="changedetails.asp" method="post">
Username <input type="text" name="txtUsername" size="20"><br>
Password <input type="password" name="txtPassword" size="20"><br>
<BR>
Title <input type="text" name="txtNewTitle" size="20"><br>
First Name <input type="text" name="txtNewFirstName" size="20"><br>
Surname <input type="text" name="txtNewSurname" size="20"><br>
Address 1 <input type="text" name="txtNewAddress1" size="20"><br>
Address 2 <input type="text" name="txtNewAddress2" size="20"><br>
Town <input type="text" name="txtNewTitle" size="20"><br>
County <input type="text" name="txtNewCounty" size="20"><br>
Post Code <input type="text" name="txtNewPostCode" size="20"><br>
Email Address <input type="text" name="txtNewEmailAddress" size="20"><br>
Telephone Number <input type="text" name="txtNewTelephoneNo" size="20"><br>
<BR>
<input type="Submit" value="Submit my New Details"><BR>
<input type="Reset" value="Clear">
</div>
</BODY>
</html>
ASP Code to add to DB
Code:
<!-- #include file="ProjectConnection.asp" -->
<!-- METADATA TYPE="typelib"
FILE="c:\Program Files\Common Files\System\ado\msado15.dll" -->
<%
Dim strConnect
%>
<html>
<head>
<body>
<div id="content">
<input type="button" onClick="document.all.content.style.zoom=(document.all.content.style.zoom==1?2:1);" value="ENLARGE TEXT">
<title>Unable to Change Your Details</title>
<H1><B><U>SORRY</U></B></H1>
There has been an error with your input;
<BR>
<BR>
<%
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
sql="select * from RegisteredUsers where Username='"&Request("txtUsername")&"'"
objRS.Open sql, strConnect, 3,3
if objRS.RecordCount <=0 then
Response.Write "The username that you have entered is invalid."
Response.Write " Please click on back on your browser and re-enter your username"
Response.End
End If
if objRS("Password")<>Request("txtPassword") then
Response.Write "The password that you have entered is invalid."
Response.Write " Please click on back on your browser and re-enter your username"
Response.End
End if
objRS.Fields("Title") = Request.Form("txtNewTitle")
objRS.Fields("First Name") = Request.Form("txtNewFirstName")
objRS.Fields("Address 1") = Request.Form("txtNewAddress1")
objRS.Fields("Address 2") = Request.Form("txtNewAddress2")
objRS.Fields("Town") = Request.Form("txtNewTown")
objRS.Fields("County") = Request.Form("txtNewCounty")
objRS.Fields("Post Code") = Request.Form("txtNewPostCode")
objRS.Fields("Telephone Number") = Request.Form("txtNewTelephoneNo")
objRS.Fields("Email Address") = Request.Form("txtNewEmailAddress")
objRS.Update
objRS.Close
Set objRS = Nothing
Response.Redirect "changedetailsconfirmation.asp"
%>
Or click <a href="amenddetails.asp">here</a>
</div>
</body>
</html>