Solved

Passing Variables

Posted on 2006-07-07
2
171 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

696 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