Solved

Passing Variables

Posted on 2006-07-07
2
167 Views
Last Modified: 2013-12-24
I am having a lot of trouble.  I've passed variables before but I'm still new at this and I am stuck.  Here is what I want to do.  I have a page that reads data from a table and displays it on the screen.  To get that here is the code I used:

<CFOUTPUT query="qType">      
        <tr class="tiny" bgcolor="C0C0C0">
        <td align="center">#strLoc#</td>
        <td align="center">#strType#</td>
        <td align="center"><INPUT type="submit"  value="Evaluate"></td>
      </tr>
</CFOUTPUT>

At the end of each row there is an evaluate button.  What I want to do is find out the #strLoc# and #strType# that the user picked.  So for example, if the table looked like this:

Memphis     Tech      Evaluate
New York     CSE      Evaluate
New York     Tech     Evaluate

If I hit the 2nd evaluate button I want to pass the New York and CSE to the next page.  Their are over 100 locations and 20 different types.   Not all users have access to see all types.  Please help!!!  
0
Comment
Question by:trifecta2k
2 Comments
 
LVL 13

Accepted Solution

by:
usachrisk1983 earned 500 total points
Comment Utility
The following snippit will do this for you -- but you shouldn't already be inside a CFFORM or FORM tag (if you are, do you have to be, or can that be avoided?  This will create a form for each line item that can be submitted.  You can reference form.<variablename> on the action page.

<CFOUTPUT query="qType">    
       <tr class="tiny" bgcolor="C0C0C0">
       <td align="center">#strLoc#</td>
       <td align="center">#strType#</td>
       <td align="center">
        <form name="frmEvaluate" action="yournextpage.cfm" method="post" style="display: inline;">
         <INPUT type="hidden"  value="#strLoc#">
         <INPUT type="hidden"  value="#strType#">
         <INPUT type="submit"  value="Evaluate">
        </form>
       </td>
     </tr>
</CFOUTPUT>

Another solution might be to have 1 form surround the whole table, and have a button (not a submit, just button) on each line that says evaluate.  You could use javascript to pass your two values (strLoc and strType) to two hidden fields in your form (say "current_strLoc" and "current_strType") and then submit the form.  I didn't provide this method as an example because it relies on JS being enabled, which is nice to avoid when you can.
0
 
LVL 5

Author Comment

by:trifecta2k
Comment Utility
The code worked great!  Thank you very much for your help.  
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now