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.