CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2006
    Location
    Baltimore, Maryland, USA
    Posts
    104

    Creating Passable Variables

    I am working with creating an web database application and I am having a bit of a problem. I have a form that is returning dynamic values in a form that will be passed to another page (action page?) to which SQL statements will be excuted. On the form page, I am using a select input statement to collect one data value from a query. I also want to create another variable, so that I will be able to use two variables from the form page with my action page inside the SQL statements.

    When I run the page, I am getting a undefined variable in form error when trying to load the action page with the SQL statments. I call myself using different combinations, but I have yet to make this created variable usable.

    here is a portion of my code:
    ===============================
    <cfparam name="variable" default="0">
    <center>
    <table border="8" cellpadding="1" cellspacing="10">
    <tr> <!--- form for submitting new entries within various tables --->
    <td align="center">
    <form action="_ITManagementPg5more.cfm" method="post" name="formNewRecords" id="formNewRecords">
    .
    .
    .
    <tr>
    <td><cfinvoke component="_COMSARE IT" method="GetComputerSoftware" returnvariable="qryComputerSoftware">
    Installed Software::<select name="selectComputerSoftware" id="selectConputerSoftware"><option value="--">--------------------</option>
    <cfoutput query="qryComputerSoftware"><option value="#ComputerID#">#SoftwareID# =+= #ComputerName# -- #Title#</option>
    <cfif isdefined ("variable")>
    <cfset variable = #SoftwareID#></cfif></cfoutput></select>
    </td>
    </tr>
    </table>
    ==============================

    ...this page loads without any problems. I am thinking I declared my variable so it exist within the form using cfparam. By assigning the variable using cfset within the query, I am grabbing the data from the query, no sweat?

    Now, my action page displays the error, variable not found in form. here is the code:
    ==============================
    .
    .
    .
    <cfif #Form.selectComputerSoftware# IS "--">
    SOFTWARE ON COMPUTER NOT REMOVED !! <br> <cfoutput>#Form.variable#</cfoutput>
    <cfelse>
    <cfoutput> #Form.variable# </cfoutput>
    .
    .
    .
    </cfquery>
    </cfif>
    <!--- End of SQL --->
    ===================================

    ... I know this is an empty SQL statement, but I am just trying to make sure my variable is being read for I am debugging. If I placed another cfparam at the begin to make sure it is still declared, I get a different error.

    I really would like to grab two variables for my SQL statement in my action page, but if I can't create one to pass over, I will only get the one variable linked by my select option value.

    Did I explain this correctly? Can I be helped?
    -= the best is yet to come =-

  2. #2
    Join Date
    May 2005
    Posts
    31

    Re: Creating Passable Variables

    What kind of script language do you use ?

  3. #3
    Join Date
    Jan 2006
    Location
    Baltimore, Maryland, USA
    Posts
    104

    Re: Creating Passable Variables

    Quote Originally Posted by Jackyquah
    What kind of script language do you use ?
    I am not using any scripting, per se... I am using straight HTML and Coldfusion tags. Coldfusion is passing the data to the action page. Anf if you want to know about the database, I am using SQL (not mySQL) when talking to the database.

    Are you suggesting a script language? Which would you use?
    -= the best is yet to come =-

  4. #4
    Join Date
    May 2002
    Posts
    10,943

    Re: Creating Passable Variables

    I am still a little fuzzy.

    You keep saying action page. What language are you using on the action page to set the SQL interaction up?
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  5. #5
    Join Date
    Jan 2006
    Location
    Baltimore, Maryland, USA
    Posts
    104

    Re: Creating Passable Variables

    Quote Originally Posted by peejavery
    I am still a little fuzzy.

    You keep saying action page. What language are you using on the action page to set the SQL interaction up?
    I say action page because that is the term I keep reading. The action page refers to the page that actually accepts the data from the form. I am using Coldfusion to interact with the SQL. If you look at the second portion of my code, this is syntax I am using for this page. <cfif> and <cfquery> surrounding the SQL Delete command. Every tag the starts with CF refers to Coldfusion.

    I believe my problem is with calling the variable from the first page. Or my problem has something to do with the creation of variable within the form using <cfparam> and <cfset>.

    (I hope I am explaining everything correctly)
    -= the best is yet to come =-

  6. #6
    Join Date
    May 2002
    Posts
    10,943

    Re: Creating Passable Variables

    Well, I'm sorry but I know nothing about ColdFusion. The only server scripting I do is PHP, some ASP and VBScript.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured