Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Passing Variables

Posted on 2006-07-07
2
Medium Priority
?
176 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 2000 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

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…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month10 days, 5 hours left to enroll

927 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