We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Element MOVIE_ID is undefined in UR

Medium Priority
548 Views
Last Modified: 2013-12-24
Hi.  I am VERY new at this.  I am running ColdFusion 9 using SQL+ for my DB.  I encounter an error that states "Element MOVIE_ID is undefined in URL."  Do you know how I can have the URL parameter work properly and "define" movie_id in find_detail.cfm?
Right now, I get a message saying the element is undefined in URL.  Do you know what I'm missing in order to define it?  Once it's defined, how do I reference it in find_detail.cfm?  #url.movie_id#?

 

    <CFQUERY NAME="movie" DATASOURCE="dba192">
       SELECT movie_id, title, category
        FROM movie NATURAL JOIN category

<cfif FORM.title IS NOT "">
WHERE movie.Title LIKE '%#FORM.title#%'
</cfif>

<cfif FORM.category IS NOT "">
WHERE movie.category LIKE '%#FORM.category#%'
</cfif>
        ORDER BY title
    </CFQUERY>

<HTML>
<HEAD>
<TITLE>Movie Mania</TITLE>
<LINK REL=STYLESHEET TYPE="text/css" HREF="../styles.css">
</HEAD>

<BODY>

<cfFORM ACTION="find_detail.cfm" METHOD="post">

<table>
<tr>
<cfoutput>
<th>
<h3>Movie List (#Movie.RecordCount# movies)</h3>
</th>
<th>
<h3>Category</h3>
</th>
</cfoutput>
</tr>
<tr><td colspan="3"><hr /></td></tr>

<cfoutput query="movie">

<tr>
<td>
#CurrentRow#:

<a href="find_detail.cfm?movie_id=#movie.movie_id#">
#Title#</a>
</td>
<td>
#category#
</td>
</tr>
</cfoutput>
</table>

</cfform>
</body>
</html>
Comment
Watch Question

CERTIFIED EXPERT

Commented:
The code you posted does not have the variable URL.movie_id, so I suspect it is in your find_detail.cfm file.

In that file, at the very top, you can add this command...

<cfparam name="url.movie_id" default="">

That will create an empty variable, if the variable does not exist.  That way you will never get the Not Defined error.

The URL scoped variables exist whenever the variable is passed in the query string (the web site URL).   For example,  www.myDomain.com/index.cfm?movie_id=123&myName=Fred

In this case index.cfm should have variables URL.movie_id and URL.myName  existing

But if you try to reference URL.user_id   it will not be defined because the above link does not contains &user_id=333


Author

Commented:
I think I am asking the wrong question.  In the find_resultsl.cfm file (previously posted), I want the user to enter a movie title into a field.  Then based on the associated movie_id, go to find_detail.cfm and return more fields from the movie DB table.  So, I'm not sure how to define movie_id from the user input to use in the find_details.cfm file.

Is there something in the file that should send the user input to the URL?
Is this correct:

<a href="find_detail.cfm?movie_id=#movie.movie_id#"></a>

or does movie_id have the wrong prefix?

Thank you so much!!!
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Thank you, gdemaria!!!  I now see what I wasn't "getting" before.  THank you for the other feedback as well.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.