Solved

Passing Variables

Posted on 2006-07-07
2
169 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
ID: 17061782
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
ID: 17061976
The code worked great!  Thank you very much for your help.  
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

776 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