[Top] [All Lists]

Re: Using variables on included files?

Subject: Re: Using variables on included files?
From: "Steve Grosz"
Date: Thu, 1 Jan 2009 20:53:05 -0700
Newsgroups: macromedia.coldfusion.cfml_general_discussion

I have the code as:


<cfform name="form1" method="post" action="CF/process2.cfm?pmode=a&tid=#url.tid#" id="FormBorder" style="margin-top:2px;"><span class="bold">Events competing in:</span><table width="98%" border="0">
<cfif #url.f# eq 1>
   <td width="15%" align="center">Open Foil</td>
<td width="10%" align="center"><input name="OpenFoil" type="checkbox" value="1" checked="yes" onClick="optionFoil(this.form)"> </td>
 <cfif #url.e# eq 1>
   <td align="center">Open Epee </td>
<td align="center"><input name="OpenEpee" type="checkbox" value="1" checked="yes" onClick="optionEpee(this.form)"></td>

<cfset id=createuuid()>
<input type="hidden" name="id" value="<cfoutput>#id#</cfoutput>">
<cfdump var="#fRating#">
<input type="hidden" name="fRating" value="<cfoutput>#check_user.u_foil_rating#</cfoutput>">
<div align="center">
<input name="Submit" type="submit" value="Register" onClick="return checkmail(this.form.FencerEmail)">


<!-- Variables which need to be defined -->
<cfparam name="URL.logout" default="0">
<cfparam name="invalid_login" default="0">

<!-- Code will not be executed unless #FORM.username# IS NOT "" -->
<cfif structKeyExists(form,"username")>

   <!-- Check Username, Password, and Level of Administration -->
   <cfquery name="check_user" datasource="SalleBoise">
           select u_id,u_fName,u_lName,u_foil_rating,u_foil_year
  from tournfencer
  where u_user='#form.Username#'

   <!-- If there is a valid User then Login user -->
   <cfif check_user.recordcount is not 0>
<!-- Log them in with a timeout of 30 minutes (1800 sec) and set level of Admin-->
       <cflogin idletimeout="1800">
                   name = "#FORM.username#"
                   password ="#FORM.password#"
                   roles = "1">
<!-- If an invalid Login Attemp, Set invalid to 1 for invalid login script -->
       <cfset invalid_login = 1>


<!-- If index.cfm?logout=1 is clicked then Log The User Out -->
<cfif URL.logout is 1>
   <cflocation url="index.cfm">

<!--- Simple index.cfm file that logs you in --->
<cfif GetAuthUser() is "">
<form name="form1" method="post" action="<cfoutput>#cgi.HTTP_REFERER#</cfoutput>">
       User: <input name="username" type="text" id="username"><br>
       Pass: <input name="password" type="password" id="password"><br>
       <input type="submit" name="Submit" value="Submit">
<cfinclude template="inc/event_reg.cfm">
   <p>User: <cfoutput>#GetAuthUser()#</cfoutput></p>
<p><cfoutput>#check_user.u_fName# - #check_user.u_id#</cfoutput><br> --->
   <a href="index.cfm?logout=1">Logout</a>
   <cfdump var="#check_user#">

"Kronin555" <webforumsuser@xxxxxxxxxxxxxx> wrote in message news:gjittr$klt$1@xxxxxxxxxxxxxxxxxxxxxxxx
If you did that dump at the very top of inc/event_reg.cfm, then there must be
code in event_reg.cfm that we don't see. Are you resetting check_user to
anything in that file?

> But if I dump the variable #fRating#, I get a message that says Element
U_FOIL_RATING is undefined in CHECK_USER

Where are you trying to dump the fRating variable? In CF/process2.cfm? In
event_reg.cfm, you are setting the value of a hidden form variable to
check_user.u_foil_rating. When this page loads, if you view source, is the
value being set correctly?

Your statement about dumping fRating leads me to believe the error is actually
occurring on a different page, not this page. What page are you actually
getting the undefined variable error?

<Prev in Thread] Current Thread [Next in Thread>