classi asp

Discussion in 'ASP General' started by paulmitchell507, Jul 25, 2008.

  1. 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>
    paulmitchell507, Jul 25, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ben
    Replies:
    3
    Views:
    1,124
  2. Andrea Raimondi
    Replies:
    1
    Views:
    448
  3. R.A.M.
    Replies:
    1
    Views:
    3,229
    =?Utf-8?B?Y2xpY2tvbg==?=
    Mar 29, 2006
  4. Daves
    Replies:
    2
    Views:
    730
    Patrice
    May 31, 2006
  5. David A. Beck
    Replies:
    10
    Views:
    1,005
    Scott McNair
    Apr 13, 2004
Loading...

Share This Page