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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

displaying data in a form

Status
Not open for further replies.

trolldude

Technical User
Apr 29, 2004
14
GB
Hi

Could you tell me what is the easiest way to add data to a form as below so that if the user has entered data in a previous session it will be displayed in the form. I have made attempts to do this but it seems to invlove huge amount of code over the 15 pages of the questionnaire.

I have copied some abridged code below to show the context of the issue.

Many Thanks for this great resource
<html>
<head>
<title>Feedback Questionnaire - Section 1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<table width="720" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<!--DWLayoutTable-->
<tr>
<td width="29" height="32">&nbsp;</td>
<td width="669" align="left" valign="middle"><cfoutput><font size="3" face="Arial, Helvetica, sans-serif"><strong><font color="##0000CC" size="2">#session.UserFirstName# #session.UserLastName# </font></strong></font></cfoutput><font color="#000000" size="2"><strong><font face="Arial, Helvetica, sans-serif">giving
Feedback to</font></strong></font><font color="#0000CC" size="2"><strong><font face="Arial, Helvetica, sans-serif">
<cfoutput>#session.RecFirstName#</cfoutput></font></strong></font></td>
<td width="22">&nbsp;</td>
</tr>
<tr>
<td height="19">&nbsp;</td>
<td align="right" valign="top"><font color="#000099" size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>See rating notes at bottom of page</strong></font></td>
<td>&nbsp;</td>
</tr>
</table>
<table width="710" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<!-- get answers data from Cohert3 to update -->
<cfquery name="GetRecordtoUpdate" datasource="virtquest1">
SELECT * FROM liv_data WHERE answerID
= #session.answerIDvalue#
</cfquery>
<cfoutput query="GetRecordtoUpdate">


<table width="720" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="##FFFFFF">
<!--DWLayoutTable-->
<form action="section2.cfm" method="Post">
<tr>
<td width="57" height="32" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td colspan="4" valign="middle"><strong><font color="##CC6633" size="3" face="Verdana, Arial, Helvetica, sans-serif">Section
1 - Leadership</font></strong></td>
<td width="10" rowspan="14" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td width="43" align="center" valign="bottom"><div align="center"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Always</font></strong></div></td>
<td width="48" align="center" valign="bottom"><p align="center"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Almost<br>
Always </font></strong></p></td>
<td width="41" align="center" valign="bottom"><div align="center"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Some-<br>
times </font></strong></div></td>
<td width="46" align="center" valign="bottom"><div align="center"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Almost<br>
Never </font></strong></div></td>
<td width="53" align="center" valign="bottom"><div align="center"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Not<br>
Relevant</font></strong></div></td>
<td width="47" align="center" valign="bottom"><div align="center"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Don't<br>
Know </font></strong></div></td>
</tr>
<tr>
<td height="63" align="center" valign="top"><font color="cc6633" size="4" face="Arial, Helvetica, sans-serif"><strong>Q1</strong></font></td>
<td colspan="4" valign="top"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> <strong>Purpose and Direction</strong><br>
Provides colleagues with a clear sense of the purpose and direction</font></td>
<td align="center" valign="middle"><input type="radio" name="s1q1" value="#1#"></td>
<td align="center" valign="middle"><input type="radio" name="s1q1" value="#2#"></td>
<td align="center" valign="middle"><input type="radio" name="s1q1" value="#3#"></td>
<td align="center" valign="middle"><input type="radio" name="s1q1" value="#4#"></td>
<td align="center" valign="middle"><input type="radio" name="s1q1" value="#5#"></td>
<td align="center" valign="middle"><input type="radio" name="s1q1" value="#6#" checked></td>
</tr>
<tr>
<td height="63" align="center" valign="top"><font color="cc6633" size="4" face="Arial, Helvetica, sans-serif"><strong>Q2</strong></font></td>
<td colspan="4" valign="top"><font color="##000000" size="2" face="Verdana, Arial, Helvetica, sans-serif"> <strong>Delegating</strong><br>
Enlists the talents of others to help meet objectives by giving them activities and sufficient autonomy to exercise own judgement<br>
<br>
</font></td>
<td align="center" valign="middle"><input type="radio" name="s1q2" value="#1#"></td>
<td align="center" valign="middle"><input type="radio" name="s1q2" value="#2#"></td>
<td align="center" valign="middle"><input type="radio" name="s1q2" value="#3#"></td>
<td align="center" valign="middle"><input type="radio" name="s1q2" value="#4#"></td>
<td align="center" valign="middle"><input type="radio" name="s1q2" value="#5#"></td>
<td align="center" valign="middle"><input type="radio" name="s1q2" value="#6#" checked></td>
</tr>

<!-- add more questions here -->
<tr>
<td height="19" colspan="12" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
<tr>
<td height="102" colspan="2" valign="top"><blockquote>
<p><font size="3" face="Arial, Helvetica, sans-serif"><strong>Comments<br>
</strong> <font size="2">(limited to 255 characters)</font> </font></p>
</blockquote></td>
<td colspan="10" valign="top"><font size="3" face="Arial, Helvetica, sans-serif">
<textarea name="s1comments" cols="50" rows="5" id="s1comments"></textarea>
</font></td>
</tr>
<tr>
<td height="48" colspan="3" valign="top"><blockquote>
<p><font color="##990000" size="2" face="Arial, Helvetica, sans-serif"><strong><font color="##000000">Click the submit button to save the answers above for Section 1 <br>
</font>
<input type="submit" name="Submit" value="Submit">
</strong></font></p>
</blockquote></td>
<td width="38" align="center" valign="middle"><strong><font size="3" face="Arial, Helvetica, sans-serif">OR</font></strong></td>
<td colspan="8" valign="top"><blockquote>
<!-- Hyperlink to next page -->
<p><strong><font color="##000099" size="2" face="Arial, Helvetica, sans-serif"><a href="section2.cfm">Click HERE to move to the next section WITHOUT saving your answers for this section</a> <font size="1">(ie. if previously saved or just browsing) </font></font></strong></p>
</blockquote></td>
</tr>
<tr bgcolor="##FFFFFF">
<td height="19" colspan="12" valign="top"><hr align="center" width="700"></td>
</tr>
<tr valign="middle">
<td height="20" colspan="3" align="left" valign="middle"><blockquote>
<a href="help.htm" target="_blank"><strong><font size="2" face="Arial, Helvetica, sans-serif"> Click here for help</font></strong></a>
</blockquote></td>
<td height="20" align="center"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td height="20" colspan="8" align="left" valign="middle"><blockquote>
<strong><font size="2" face="Arial, Helvetica, sans-serif"><a href="logout.cfm">Click here to Log out</a></font></strong>
</blockquote></td>
</tr>
<tr>
<td height="2"></td>
<td width="122"></td>
<td width="152"></td>
<td></td>
<td width="63"></td>
</tr>
</form>
</table>
</cfoutput>


</body>
</html>

TOP OF NEXT PAGE

<cfif IsDefined("Form.submit")>
<cfquery name="UpdateRecord" datasource="virtquest1">
UPDATE liv_data
SET s1q1 = #form.s1q1#,
s1q2 = #form.s1q2#,
s1q3 = #form.s1q3#,
s1q4 = #form.s1q4#,
s1q5 = #form.s1q5#,
s1q6 = #form.s1q6#,
s1q7 = #form.s1q7#,
s1q8 = #form.s1q8#,
s1q9 = #form.s1q9#,
s1q10 = #form.s1q10#,
s1q11 = #form.s1q11#,
s1q12 = #form.s1q12#,
s1q13 = #form.s1q13#,
s1comments = '#form.s1comments#'
WHERE answerID = #session.answerIDvalue#
</cfquery>
</cfif>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top