Access db dropdown til <input type=Text value= Response Write ?
Hej Genier.Jeg vil gerne populate input type=Text med data fra databasen i ASP.
Men det skal ske gennem en dropdownlist menu!
Please help... Jeg har rodet med det i 2 uger.....
Se mit link: http://www.pilatesudstyr.com/tester/thetestasp.asp
CODE:
<%@ Language=VBScript %>
<%Option explicit
Dim oRs, conn, connect, strSQL
set conn=server.CreateObject ("adodb.connection")
connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("cykeldata.mdb") & ";Persist Security Info=False"
conn.Open connect
%>
<script language="javascript">
<!--
function dept_onchange(frmSelect) {
frmSelect.submit();
}
//-->
</script>
<html>
<body bgcolor="#ffffff" link="black">
<table width="641" border="0" cellspacing="0" cellpadding="3">
<tr>
<td valign="top" width="408">
<div align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="80%">
<div align="left">
<form name="frmSelect" method="Post" action="thetestasp.asp">
<div align="left">
<select name=hjul language=javascript onchange="return dept_onchange(frmSelect)">
<%
Set oRs=Server.CreateObject("adodb.recordset")
strSQL = "SELECT ID_no, beskrivelse FROM tblhjul ORDER BY ID_no"
oRs.Open strSQL, conn
Do while not oRs.EOF
if Request.Form("hjul") = oRs("ID_no") & oRS ("beskrivelse") then Response.Write "<OPTION VALUE = '" & oRS ("ID_no") & (" ") & oRS ("beskrivelse") & "' SELECTED>"
Response.Write oRs("ID_no") & oRS ("beskrivelse") & "</Option>"
oRs.MoveNext
else
Response.Write "<OPTION VALUE = '" & oRS ("beskrivelse") & "'>"
Response.Write ("db ID") & (" ") & oRS ("ID_no") & (" ") & "</Option>"
oRs.MoveNext
end if
loop
%>
</select></div></form>
</div>
</td>
</tr>
</table>
<font size="2" color="#ff3300" face="Verdana, Arial, Helvetica, sans-serif"> </font>
<div align="center">
</div>
<table width="100%" border="1" cellspacing="0" cellpadding="5">
<tr>
<td width="19%">
<div align="left">
<font face="Verdana, Arial, Helvetica, sans-serif"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Beskrivelse</font></font></div>
</td>
<td width="34%">
<div align="left">
<input type="text" name="textfieldName" value='<%=Request.Form ("hjul")%>' size="20"></div>
</td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<font color="#ff3300" face="Verdana, Arial, Helvetica, sans-serif"><b>Her opstår problemet!<br>
</b></font></div>
</td>
</tr>
<tr>
<td width="19%"><font size="2" color="#ff3300" face="Verdana, Arial, Helvetica, sans-serif">Moms</font></td>
<td width="34%"><input type="text" name="textfieldName" value="<% Response.Write(" ? ") %>" size="10"> - Her vil jeg gerne hente data fra db id. Men fra et andet Field Name?</td>
</tr>
<tr>
<td width="19%"><font size="2" color="#ff3300" face="Verdana, Arial, Helvetica, sans-serif">Ex. Moms</font></td>
<td width="34%"><input type="text" name="textfieldName" value="<% Response.Write(" ? ") %>" size="10"> Samme her.!</td>
</tr>
<tr>
<td width="19%"><font size="2" color="#ff3300" face="Verdana, Arial, Helvetica, sans-serif">Incl. Moms</font></td>
<td width="34%"><input type="text" name="textfieldName" value="<% Response.Write(" ? ") %>" size="10"> Og her!</td>
</tr>
</table>
<p></p>
</div>
</td>
<td valign="top">
<div align="center">
<img src="pics/dbpic.jpg" alt="" border="0"></div>
</td>
</tr>
</table>
</body>
</html>
Code slut...