Skip to main content
April 24, 2006
Question

updating a database.

  • April 24, 2006
  • 4 replies
  • 732 views
at the moment is am trying to create a page to update a database.

i select the a company in a list which the gets forwarded to the next page. On the next page i tell the page that the it has to display all the information from the selected company by telling it that "Where #form.companytxt# = CompanyCode"


the problem i am getting is that it puts all the information into a form. however when i want to update the form it refers to "companytxt" from the above statement. And as it is not in this form it is getting confused. what would be the best way of doing this?
This topic has been closed for replies.

4 replies

Inspiring
April 26, 2006
To convert it to a session variable,
<cfset session.companytxt = form.companytxt>

Before you do that, put this at the top of page 3.
<cfdump var="#form#">
<cfabort>

Does your hidden field show up?
April 27, 2006
Coldfusion is harder than i thought. i have got the following done so far... but then i get the error

Parameter 1 of function IsDefined, which is now &quot;2B617C71-B310-4D13-B9At3AFBE454FDE1&quot;, must be a syntactically valid variable name. how do i remove the &quote; ?




Inspiring
April 26, 2006
If you managed to pass a company code from a select from page 1 to page 2, the problem is not with page 1. Question, what are you doing with the company code on page 2? If you are not converting it to a session variable or a hidden form field on your page 2 form, how are you going to know what record to update on page 3?
April 26, 2006
i am totally new to this.but i thought i had created a hidden field...

<input type="hidden" name="companytxt" value="#form.companytxt#">

but this didn't work.....

Stupdi question but how do i convert it to a session variable?
April 24, 2006
It seems as though your WHERE clause is backwards. It probably should be WHERE companyCode = '#form.companyTxt#'
April 26, 2006
even changing that it cant find find it after i click update.

would it be handier to do an

<cfif not isdefined (#form.companytxt#)>
cflocation ****firstpage*****
<cfidelse>
cflocation *****this page ?sid=#form.companytxt#
</cfif>

and then set the where statement to companyCode = '#URL.SIDt#'

I think the problem is with the dropdown menu select in the previous page.........
April 24, 2006
i was thinking could i have something where it refers to form1(first page) to get the company name and form2 (second page) to update the sql database?