Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > classi asp

Reply
Thread Tools

classi asp

 
 
paulmitchell507
Guest
Posts: n/a
 
      07-25-2008
As my post will demonstrate, I am just picking up ASP as I go. I
have
written the small ASP app below. For some reason I can't get my head
around how I can pass the staff_ID value to add_to_database.asp. I
donlt want to display the value but I want to input the value into my
holiday_tbl.

<%@ Language=VBScript %>
<%Option explicit
Dim oRs, conn, connect, strSQL, inpSQL


set conn=server.CreateObject ("adodb.connection")
connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("staff.mdb") & ";Persist Security Info=False"
conn.Open connect


%>
<html>
<head>
<title>Example combo box</title>


<script language="javascript">
<!--


function dept_onchange(frmSelect) {
frmSelect.submit();



}


//-->
</script>
</head>
<body>
The following was selected : <%=Request.Form("courses")%>

<form name="frmSelect" method="Post" action="select.asp">
<SELECT name=courses LANGUAGE=javascript onchange="return
dept_onchange(frmSelect)">
<%
Set oRs=Server.CreateObject("adodb.recordset")
strSQL = "SELECT Status_ID, Staff_ID, firstlastName FROM staff
WHERE
Status_ID=1 Or Status_ID=19 ORDER by firstlastname"
oRs.Open strSQL, conn


Do while not oRs.EOF
if Request.Form("courses") = oRs("firstlastName") then
'if this is
the selected one then display as selected
Response.Write "<OPTION VALUE = '" & oRS
("firstlastName") & "'
SELECTED>"
Response.Write oRs("firstlastName") & "</
Option>"
oRs.MoveNext
else
Response.Write "<OPTION VALUE = '" & oRs
("firstlastName") & "'>"
Response.Write oRs("firstlastName") & "</
Option>"
oRs.MoveNext
end if
loop
%>


</SELECT>
</form>
<html>
<head>
<title>Form to Database</title>
</head>
<body>
<!-- comment - start the HTML form and use a HTML table for
formatting-->
<form name="form1" action="add_to_database.asp" method="post">
<div align="center">
<table width="80%" border="0">
<tr>
<td>StartDate :</td>
<td><input type="text" name="StartDate"></td>
</tr>
<tr>
<td>EndDate :</td>
<td><input type="text" name="EndDate"></td>
</tr>
<tr>
<td><input type="HIDDEN" name="courses" value="<
%=Request.Form("courses")%>"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="submit details" name="submit"></td>
</tr>
</table>
</div>
</form>
The following was selected : <%=Request.Form("courses")%>
<!-- end the HTML form-->
</body>
</html>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
global filter to redirect asp (old asp!) pages on asp.net site Daves ASP .Net 2 05-31-2006 08:33 AM
2.0: asp:Menu, asp:XmlDataSource, asp:PlaceHolder R.A.M. ASP .Net 1 03-29-2006 07:55 AM
[ASP.NET1.1]Should I kill the ASP.NET worker process after recompilingmy ASP.NET webservice? Andrea Raimondi ASP .Net 1 02-06-2006 08:10 AM
ASP.Net cookie -> ASP -> ASP.Net Ben ASP .Net 3 05-28-2004 03:35 PM
LOOP through an ASP form's pages (not ASP.NET - ASP classic) David A. Beck ASP General 10 04-13-2004 05:38 PM



Advertisments