Table
to insert into:
tlnkPolicy
PolicyID - PK
DistrictID - FK
PolicyNumber - FK
District - Yes/No
School - Yes/No
PolicyDesc
tlnkPolicy
PolicyID - PK
DistrictID - FK
PolicyNumber - FK
District - Yes/No
School - Yes/No
PolicyDesc
Form
page:
<cfquery
name="qryPolicy" datasource="sdfs">
Select PolicyNumber, PolicyName
From tblPolicy
</cfquery>
Select PolicyNumber, PolicyName
From tblPolicy
</cfquery>
<form
name="TargetGroups" action="ProcessPage7.cfm" method="post">
<table border="1"><tr><th>District Policy</th><th>School Option</th></tr><tr>
<table border="1"><tr><th>District Policy</th><th>School Option</th></tr><tr>
<td><input type="hidden" value="#Policynumber#"
name="Policynumber">
<input type="Checkbox" value="" name="District"> </td>
<td><input type="Checkbox" value="" name="School"> </td>
<td><font size="-1" style="TimesNewRoman"> #Policyname#</font></td></tr>
<input type="Checkbox" value="" name="District"> </td>
<td><input type="Checkbox" value="" name="School"> </td>
<td><font size="-1" style="TimesNewRoman"> #Policyname#</font></td></tr>
</cfoutput></table>
<input type="Submit" value="SUBMIT">
<input type="Submit" value="SUBMIT">
</form>
Action
Page:
<cfloop
list="#PolicyNumber#" index="i">
<cfquery datasource="#application.db#">
Insert into tlnkPolicy (DistrictID, District, School, PolicyNumber)
Values ('#session.DistrictID#', '#form.District#', '#form.School#', #i#)
</cfquery>
</cfloop>
<cfquery datasource="#application.db#">
Insert into tlnkPolicy (DistrictID, District, School, PolicyNumber)
Values ('#session.DistrictID#', '#form.District#', '#form.School#', #i#)
</cfquery>
</cfloop>
The problem is that no
matter what I do or do not check in the checkboxes on the form, all of the
policynumber(s) show up in the database and nothing in the District or School
columns. There should be blanks or yes in the District or School columns.
And I do not want to see a record for a policynumber if there is no check in
District, School or both
