I am developing a simple web site in ASP. I have a web page which has a form, and I want to set the values of two text box to 2 fields selected by a query. One of the fields is a name field which has the First Name and the Last Name separated by a space. The text box only shows the First Name and not the last Name. Any idea how to show the complete field value?
Code:
<%
Response.Expires = 0
Response.Cookies ("name")= ""
Response.Cookies ("Eid")= ""
Dim a,b,c,e,f,con,strQx,rs,strUrl,connectionString,nm,eid
a = Request.Form("t1")
b = Request.Form("t2")
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\My Documents\My Team\TM Testing\Team Details4.mdb;"
Set con = Server.CreateObject("ADODB.Connection")
con.Open connectionString
Set rs = Server.CreateObject("ADODB.Recordset")
strQx = "SELECT Users.NAME, Users.[EMP ID] FROM Users WHERE UserID='"&a&"' AND Password='"&b&"' "
rs.Open strQx,con, adOpenForwardOnly, adLockOptimistic
If rs.EOF Then
rs.close
Set rs = Nothing
con.close
Set con = Nothing
strUrl = "http://localhost/index.htm"
strUrl = strUrl & "?Error"
Response.Redirect strUrl
End If
c = rs("Name")
e = rs("EMP ID")
%>
<html>
<head>
<title>Online Tracker System</title>
</head>
<body onload=setfoc()>
<h1><font face="Calibri" size="6" color="#99FFCC"><b><img border="0" src="image3061.gif" width="377" height="114">Online
Tracker System </b></font><img border="0" src="image315.gif"></h1>
<form method="POST" name="f1" action="upload.asp">
<p align="left"><font face="Arial Rounded MT Bold"><font size="2">Week:</font> <select size="1" name="D1" tabindex="1">
<option>WK1</option>
<option>WK2</option>
<option>WK3</option>
<option>WK4</option>
<option>WK5</option>
</select> <font size="2">Date :</font> <input type="text" name="T1" size="17" onclick="OpenWin()" readonly tabindex="2">
<font size="2">Name:</font> <input type="text" name="T2" value=<%=rs("Name")%> size="37" readonly style="position: relative">
</form>
<script language ="JavaScript">
<!--
function setfoc()
{
document.f1.D1.focus();
}
-->
</script>
</body>
</html>
Comment