Solved

Passing Variables

Posted on 2006-07-07
2
170 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Configure a Local PHP Interpreter for Phpstorm 2 332
change time in cron 4 86
Setting Up Local Lan Web Server 1 64
Standalone trial or freeware to do SSL scan 4 30
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…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

839 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