Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 10th, 2008, 11:22 PM
Registered User
 
Join Date: Nov 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default creating a form with input text that is populated

Okay so I am trying to put together a page where we record employees hours worked. After validating the supervisors name and pin number from the table jraspin . It then populates a form with an employee list that matches that supervisor name from a table named emplist . The supervisor will then input the hours worked for each of those employees and submit them where I will have it write to a seperate database. My problem is I can't figure out how to set the names of the text input so I can transfer all of the data over to the on submit page which will then take the data, transfer it into variables and then post the variables to the new table. As of right now each text input has the same name therefore when trying to pull it over using request.form. Take a look at my code and let me know if you know how to do this. I am trying to transfer the name over and the rest of the input information as well. Thank you in Advance

Code:
<html>




<body>
<H3 align="center">Enter the hours for the following employees</H3>


<% 
Dim intPin, supervisor, Rs, sql_select, strsupervisor 
intPin = request.Form("intPin")
supervisor = request.Form("supervisor")
Set Rs = Server.CreateObject("ADODB.Recordset") 
sql_select= "SELECT * FROM jraspin WHERE pin='"& intPin & "' "
Rs.Open sql_select, DataConn, 0,1
IF NOT (RS.BOF AND RS.EOF) THEN
'If intPin <> Rs("pin") Then
'response.Write("<br /> Please input a correct pin")
'ELSE
strSupervisor= rs("supervisor")
strSupervisor=Replace(strSupervisor, ",","")
Rs.Close 
Set Rs = Nothing
ELSE
response.Write("Pin Code not valid. ")
END IF
IF supervisor <> strSupervisor Then
response.Write("Pin Code and Name do not Match")
ELSE   
%>
This part creates the headers for the data

Code:
<FORM NAME="hours_record" ACTION="hours_process.asp" METHOD=POST>

    <TABLE border="1" STYLE="font-size:x-small">
<TR BGCOLOR=CCCCCC>
 <TH VALIGN=TOP bordercolor="#000000"><span class="style11">Employee Name</span></TH>
    <TH VALIGN=TOP bordercolor="#000000" class="style11">Regular Hours</TH>
 <TH VALIGN=TOP bordercolor="#000000" class="style11">Over Time Hours</TH>
 <TH VALIGN=TOP bordercolor="#000000" class="style11">PTO Hours</TH>
 <TH VALIGN=TOP bordercolor="#000000" class="style11">Holliday Hours</TH>
 <TH VALIGN=TOP bordercolor="#000000" class="style11">Bearevment Hours</TH>
    <TH VALIGN=TOP bordercolor="#000000" class="style11">Days Without Pay - Salary Only</TH>
    </TR>
This part is what I need help with...

Code:
    
<%
DIM SQL_emplist,RS_emplist

SQL_emplist = "SELECT * FROM emplist WHERE supervisor='" & strSupervisor & "' "
SET RS_emplist = Server.CreateObject("ADODB.Recordset")
RS_emplist.open SQL_emplist, DataConn, 0,1

IF NOT (RS_emplist.BOF AND RS_emplist.EOF) THEN
 DO UNTIL RS_emplist.EOF

' the next part is where i am not sure how to name the text boxes since there are multiple
' entries on the RS so it will be repeated at least 5 times sometimes upto 50. 

%>  


  <TR>
         <TD VALIGN=TOP bordercolor="#000000" class="style11"><%=RS_emplist("lastname")%>,<%=RS_emplist("firstname")%></TD>
            <TD VALIGN=TOP bordercolor="#000000" class="style11"><div align="center">
              <INPUT TYPE=TEXT NAME="reghours" MAXLENGTH=3 SIZE=8>
    </div></td>
   <TD VALIGN=TOP bordercolor="#000000" class="style11"><div align="center">
     <INPUT TYPE=TEXT NAME="overtime" MAXLENGTH=3 SIZE=8>
      </div></td>
      <TD VALIGN=TOP bordercolor="#000000" class="style11"><div align="center">
        <input type=TEXT name="paidtimeoff" maxlength=3 size=8>
       </div></td>
    <TD VALIGN=TOP bordercolor="#000000" class="style11"><div align="center">
      <INPUT TYPE=TEXT NAME="holliday" MAXLENGTH=3 SIZE=8>
    </div></td>
          <TD VALIGN=TOP bordercolor="#000000" class="style11"><div align="center">
            <INPUT TYPE=TEXT NAME="bearevment" MAXLENGTH=3 SIZE=8>
          </div></td>

           <TD VALIGN=TOP bordercolor="#000000" class="style11"><div align="center">
             <INPUT TYPE=TEXT NAME="daysNoPay" MAXLENGTH=3 SIZE=8>
           </div></td>


  </TR>
<%
RS_emplist.MoveNext()
 LOOP
END IF
%> 
      <tr>
  <td> <div align="center">
    <input id="submit_pin" type="submit" value="Submit">
   </div></TD>
 </tr>

</TABLE>

</FORM>
<%
END IF
%>

    <a href="enter_pin.asp">Click Here to Return</span></a></div>
</body>
</html>
If first you don't succeed - Post in a forum.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a report receiving input on range Jnaylor28 Access VBA 1 July 12th, 2005 11:54 PM
Value not being populated in Text Box ashu_gupta75 Classic ASP Basics 2 April 19th, 2004 11:21 PM
Creating an Input Mask in a text box in VB.NET ysu_computer_lab VS.NET 2002/2003 1 November 5th, 2003 02:40 PM
Display bar code in a Form using user input text? phoenixcu Access VBA 1 June 6th, 2003 02:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.