i have a problem passing variables to an edit page, it passes the field 
pol_question fine but for the answer fields my loop is incorrect, it just 
reproduces the answers 5 times each. each answer is the ans_answer table is 
related to the pol_question through the pol_id, any help would be 
appreciated,


<html>
<head>
<title>Update Poll</title>
</head>

<body bgcolor="#FFFFCC" link="#996633" vlink="#CC9966" alink="#CC9966">

<!--- <CFIF ISDEFINED("#url.Pol_id#")>
        No Pol_id Passed!
</CFIF>  --->

<CFQUERY NAME="GetPollDetails" DATASOURCE="quickpoll">
        SELECT pol_ID, pol_Question, pol_Category, pol_Status
        FROM pol_Poll
        WHERE pol_ID = #URL.PollID#
</CFQUERY>

<CFQUERY NAME="GetAnswers" DATASOURCE="quickpoll">
        SELECT ans_ID,ans_Ans
        FROM ans_Answer A
        WHERE ans_pol_ID = #url.PollID#
</CFQUERY>
<!-- Display HTML FORM Here with values filled -->
<cfoutput query="getpolldetails">
<form method="POST" action="PollUpdate.cfm">
<!--- <textarea rows="5" name="MainText" cols="45"> --->

<p>&nbsp;</p><p>Poll: <input type="Text" textarea rows="5" cols="45" 
name="pol_question" size=40 value="#pol_question#">
<!--- <INPUT NAME="question" SIZE=10 VALUE="#pol_question#"> --->

<!--- <input type="hidden" name="pol_ID" value="#url.pol_id#">
---></p></cfoutput>


<CFSET Ans1="">
<CFSET Ans2="">
<CFSET Ans3="">
<CFSET Ans4="">
<CFSET Ans5="">

<!--- get first record --->
<CFLOOP QUERY="GetAnswers">
<CFSET Ans1=#ans_Ans#>
<input type="hidden" name="ans_id1" value="#ans_id#">
</CFLOOP>

<!--- get second record etc the cfloop may not work as coded! --->
<CFLOOP QUERY="GetAnswers">
<CFSET Ans2=#ans_Ans#>
<input type="hidden" name="ans_id2" value="#ans_id#">
</CFLOOP>

<CFLOOP QUERY="GetAnswers">
<CFSET Ans3=#ans_Ans#>
<input type="hidden" name="ans_id3" value="#ans_id#">
</CFLOOP>

<CFLOOP QUERY="GetAnswers">
<CFSET Ans4=#ans_Ans#>
<input type="hidden" name="ans_id4" value="#ans_id#">
</CFLOOP>

<CFLOOP QUERY="GetAnswers">
<CFSET Ans5=#ans_Ans#>
<input type="hidden" name="ans_id5" value="#ans_id#">
</CFLOOP>


<cfoutput query="getanswers">
<p>Answer1:
  <input type="text" name="answer1" size="45" value="#Ans1#">
  <br>
  Answer2:
  <input type="text" name="answer2" size="45" value="#Ans2#">
  <br>
  Answer3:
  <input type="text" name="answer3" size="45" value="#Ans3#">
  <br>
  Answer4:
  <input type="text" name="answer4" size="45" value="#Ans4#">
  <br>
  Answer5:
  <input type="text" name="answer5" size="45" value="#Ans5#">
  <br>
</p></cfoutput>
<p>Status:
  <select name="status" size="1">
    <option value="All">All</option>
    <option value="New">New</option>
    <option value="Active">Active</option>
    <option value="Archive">Archive</option>
    <option value="Hide">Hide</option>
  </select>
  Category:
  <select name="category" size="1">
    <option value="All">All</option>
    <option value="sports">sports</option>
    <option value="current affairs">current affairs</option>
    <option value="general">General</option>
  </select>
   <!--- Above need code to select the correct value should create function 
or just use
  IFS Poll Type:  --->
  <INPUT name=polltype type=radio value=Y>
  Yes/No
  <INPUT name=polltype type=radio value=M>
  Multiple Choice </p>
<p>
  <input type="submit" value="Update Poll" name="submit"></form>
  </p>

</body>
</html>




________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to