|
BeTheBall -> RE: Reading from one table then writing to another (6/9/2004 20:34:41)
|
Now we need to add the rest of the form and a few small pieces of code that will help us later on when we actually perform the INSERT. Each record will contain the following: ClassCode recDate PupilID & Present In my mind, I am thinking that most students are present most days. So, why not use a radio button field with the "Present" value prechecked? Since you need to generate a radio button field for each student, you need to place the code between: <!--#include file="_fpclass/fpdbrgn1.inc"--> AND <!--#include file="_fpclass/fpdbrgn2.inc"--> You may or may not know, but everything between those two includes is part of a loop. So anything we place there will be repeated for each record returned. Since your results are in a table, I would create a new column in Normal View of FP. Then, switch to HTML view and within the new <td> tag you just created in Normal view, place this code: Present (On-Time)<input type="radio" value="P" checked name="Present<%=i%>">Late <input type="radio" name="Present<%=i%>" value="P">Absent <input type="radio" name="Present<%=i%>" value="P"> <input type="HIDDEN" name="PupilID<%=i%>" Value="<%=FP_FieldVal(fp_rs,"PupilID")%>"> Now, you are probably wondering what the "i" is all about. Well, to perform our bulk insertion of records, we need to give each field name a distinct name. The "i" is going to help us do that. Just above: <!--#include file="_fpclass/fpdblib.inc"--> Put this: <%i=0%> Then, just after: <!--#include file="_fpclass/fpdbrgn1.inc"--> put: <%i=i+1%> That will cause i to increase by one each time you loop through the records. As a result, the field PupilID will actually become PupilID1 for the first record, PupilID2 for the second record, and so on. Finally, before the </form> tag, place this: <input type="text" name="RecordCount" Value="<%=i%>" size="2"> Now we are ready to test again. Go to the first form where you enter the ClassCode and submit it. When Attendance_Form.asp loads, we first hope for no error messages. If there are none, do "View", "Source" in Internet Explorer. You should see form fields such as, Present1, Present2, Pupil1, Pupil2 and the value for the field RecordCount should be the same as the number of records displayed. Good luck.
|
|
|
|