Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFLOOP if data exists, then Update, if not....exclude 1

Status
Not open for further replies.

rojas1mg

Programmer
Jun 15, 2004
119
0
0
US
Here's what I have on my display page
Code:
<cfloop from="1" to="10" index="Register">
<tr>
<!---Enter name (Last, First)--->
	<td><input type="text" name="name#register#" size="45"></td>
<!---Rank--->
	<td><select name="rank#register#">
		<cfoutput query="rank">
		<option value="#Rank_ID#">#Rank#</option>
		</cfoutput></select></td>
<!---Enter SSAN--->
	<td><input type="Text" name="SSN#register#" size="15"></td>
	<!---Enter e-mail address--->
	<td><input type="Text" name="email#register#" value="@varich.ang.af.mil" size="30"></td>
<!---Select Unit--->
	<td><select name="Unit_ID#register#">
		<cfoutput query="dp_unit">
		<option value="#Unit_ID#">#Unit#</option>
		</cfoutput></select></td>
<!---Select Refresher Class Dated--->
	<td><cfoutput query="class">#Course_Date#</cfoutput></td>
</tr>
</cfloop>

On my action page I have:

Code:
<cfquery datasource="#dsource#">
INSERT INTO tbl_roster(name, Rank_ID, SSN, email, Unit_ID, Course_ID)
VALUES('#form.name#', #form.Rank#, #form.ssn#,'#form.email#', #form.unit_ID#, #form.course_id#)
</cfquery>

What I believe I have to do is write a loop for the action page to check and make sure data is being passed through on those input fields and if so, update the table. If not, exclude it. If this doesn't make sense, let me know. Thanks guys.

rojas1mg - - - I love Tek-Tips and all members who reply.
 
SUCCESS!!!!! I had also mistyped "form.rank_id_id... and it should've been "form.rank_id. Thank you bombboy for helping me. You are the GREATEST!

rojas1mg - - - I love Tek-Tips and all members who reply.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top