This is real basic, but you should get the idea:

<CFQUERY name="GetQuestions" dataSource="#request.dsn#">
  SELECT 
    q.QuestionID, 
    q.Question,
    q.SortOrder
  FROM tbl_questions q
  ORDER BY q.SortOrder
</CFQUERY>
<cfoutput>

Form page
<table>
<form action="loop.cfm" method="post">
<input type="hidden" name="NumRows" value="#GetQuestions.RecordCount#">
<cfloop query="GetQuestions">
<cfset row = GetQuestions.CurrentRow >
<tr>
  <td>
  <input type="hidden" name="QuestionID_#row#" value="#QuestionID#">
  <input type="text" name="SortOrder_#row#" value="#SortOrder#" size="2">
  #Question#
  </td>
<tr>
</CFLOOP>
<tr>
  <td>
  <input type="Submit" 
        value="Update" 
        onclick="this.value='Please wait...'">
  </td>
<tr>
</form>
</table>
</cfoutput>

Action Page
<cfloop index="id" from="1" to="#NumRows#">
  <cfset SortOrder = Evaluate("SortOrder_" & id)>
  <cfset QuestionID = Evaluate("QuestionID_" & id)>
  <CFQUERY NAME="Update" DATASOURCE="#request.dsn#">
    UPDATE tbl_questions  
      SET 
        SortOrder = #SortOrder#
    WHERE QuestionID = #QuestionID#
  </CFQUERY>
</CFLOOP>

I just threw this together with a local dsn on my system.

Aftershock Web Design, Inc.
by: Stan Winchester
President/Developer
[EMAIL PROTECTED]  
http://www.aftershockweb.com/   
Phone 503-244-3440
Fax 503-244-3454

>yes a sort order and yes they could theoretically have one or more 1's or
>any other number but that is how they will be displayed on the page.
>----- Original Message ----- 
>From: "Stan Winchester" <[EMAIL PROTECTED]>
>To: "CF-Talk" <[email protected]>
>Sent: Tuesday, June 07, 2005 6:51 PM
>Subject: Loop form input
>
>
>> When you say ranking, is this like a sort order, or can more than one
>testimonial share the the same ranking?
>>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208912
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to