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

Displaying different form results on the same page!!!

Status
Not open for further replies.

zuu2343

IS-IT--Management
Sep 18, 2002
12
US
Hi,
Is it possible to display form results from different forms on the same page without using database?

The thing is I have 3 different forms and user will enter info to the display page.

Different people will use different forms and clicking the submit button will take them to the display page and they will also see what other people entered using these forms with their information.

Without no database, please tell me that it is possible to do something like this. (like guestbook?)

Thank you
 
Sounds entirely possible.
What isn't clear is the portion you're having trouble with.

If you want to result page to display different information depending on which web form the user filled out, simply add a hidden field in each form that identifies it... something like:
Code:
<FORM action=&quot;resultpage.cfm&quot; method=&quot;post&quot; ...>
    :
<INPUT type=&quot;hidden&quot; name=&quot;formid&quot; value=&quot;form1&quot;>

Then in resultpage.cfm, simply check the value of
Code:
FORM.formid
and display accordingly:

Code:
<CFSWITCH expression=&quot;#lcase(FORM.formid)#&quot;>
<CFCASE value=&quot;form1&quot;>
    display for form 1 data
</CFCASE>
<CFCASE value=&quot;form2&quot;>
    display for form 2 data
</CFCASE>
     :
</CFSWITCH>

In order to save the data without a database, you'd need to write it out to a file with
Code:
<CFFILE action=&quot;APPEND&quot; ...>

I don't know the difference between your 3 forms, so it's difficult to know how best to write the data out... if the 3 forms have completely different data being submitted, it might be that you should write to 3 separate files... if the 3 forms have very similar data, just in a different order, you might be able to write everything to a single file.

Lastly, if you're after a guestbook type of display (ie - once submitted, the data will not change), you might find it advantageous to write the output as HTML (include HTML tags - tables, tr's, td's, styles, etc) so that all you'd need to do in your display page is
Code:
<CFINCLUDE template=&quot;form1output.txt&quot;>
and be done with it... otherwise you'd need to read 'em back in with
Code:
<CFFILE>
and probably do some parsing.

Hope it helps,
-Carl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top