help <a href="scenes25.cfm?folderNum=#FORM.number#"> work

Posted on 2004-11-01
Last Modified: 2013-12-24

I'm trying to pass a form variable via the URL and retrieve with this query

<cfquery name="getFolderNumber" datasource="xxx">
SELECT folderNum
FROM imageNames
WHERE folderNum = #URL.folderNum#
Question by:gregoryrsmith
    LVL 8

    Accepted Solution

    Hi gregoryrsmith,

    What is the error message or what is not working? Two things:

    1) Make sure you have a <cfoutput></cfoutput> around the link, e.g. <cfoutput><a href="scenes25.cfm?folderNum=#FORM.number#"></cfoutput>
    2) For security purposes, use <cfqueryparam> in you query:

    <cfquery name="getFolderNumber" datasource="xxx">
    SELECT folderNum
    FROM imageNames
    WHERE folderNum = <cfqueryparam cfsqltype="cf_sql_integer" value="#URL.folderNum#">

    3) Make sure URL.folderNum exists before you try to use it: <cfif isDefined("URL.folderNum")> ...
    LVL 17

    Expert Comment

    And make sure its an integer, if its a string you will need quotes around the value, i.e.

    <cfquery name="getFolderNumber" datasource="xxx">
    SELECT folderNum
    FROM imageNames
    WHERE folderNum = '#URL.folderNum#'

    But it would help to see some error message to solve your problems...
    LVL 11

    Expert Comment

    just a question why are u sending a form variable in the url, if u submit the form u will always get it in the processing page
    kindly be more elaborate on your problem

    LVL 35

    Expert Comment

    You could also change the form to get instead of post and it will automatically go in the URL.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    IT Security CISA, CISSP & CISM Certification

    Master the advanced techniques required to protect network resources from external threats with the IT Cyber Security bundle. Built around industry best-practice guidelines, the IT Cyber Security bundle consists of three in-depth courses.

    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…
    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…
    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…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    860 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

    14 Experts available now in Live!

    Get 1:1 Help Now