Need help with syntax for a passed parameter...

Posted on 2006-04-23
Last Modified: 2013-12-24
I'm an experienced programmer but I am new to ColdFusion.

I have this line in my code ...

<a href="recipe_page.cfm?varID=7"class="linktext">Medley of Brown &amp; Wild Rices</a>      

It's actually in the page recipe_page.cfm ... basically, I'm in a recipe page (which is totally dynamic) and I want to click on a link to go to another recipe. I was testing it with my recipe #7.

The "7" is available in a recordset ...  

What is the proper syntax for me to replace the "7" in my line of code with the value that is in the field?
I've tried a few "obvious" syntaxes but haven't hit on the right one yet!
Question by:alicia1234

    Author Comment

    I have to expand my question:

    In the line of code previously mentioned ...
    <a href="recipe_page.cfm?varID=#URL.varID#" class="linktext">Medley of Brown &amp; Wild Rices</a>      
    "Medley of Brown .... " is also available in a field and I need help with what to replace that text with to make it dynamic.

    Here is my table setup:

       RecipeID  (primary key)
       ...  (other fields but they aren't relevant to this question)


    The tables are related by RecipeID

    So in tblSides, "RecipeID" would be the key for me to find the RecipeName in tblRecipes.
    LVL 7

    Accepted Solution

    Not sure of your specifics.  

    General approach is to get field values from query:
    <cfquery datasource="dsRecipes" name="qryRecipes">
    SELECT recipeID, recipeName FROM tblRecipes

    Then use these to build your page
    <cfoutput query="qryRecipes">
    <a href="recipe_page.cfm?varID=#qryRecipes.recipeID#" class="linktext">#qryRecipes.recipeName#</a>  
    LVL 7

    Assisted Solution

    In your action page you get the selected recipe in the url variable:

    <cfset theRecipeID = url.varID>

    <cfquery datasource="dsRecipes" name="qrySides">
    SELECT sideID, side FROM tbleSides WHERE recipeID = #theRecipeID#>

    <cfoutput query="qrySides">

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    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…
    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…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    728 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

    24 Experts available now in Live!

    Get 1:1 Help Now