Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with Update form

Status
Not open for further replies.

judym5

Programmer
Apr 10, 2002
6
US
I am having a problem with my update form. Here is the code I have in my updateform.


<cfquery name=&quot;GetEventtoUpdate&quot; datasource=&quot;Events&quot;>
SELECT *
FROM Events
WHERE ID = #URL.ID#
</cfquery>



<cfoutput query=&quot;GetEventtoUpdate&quot;>
<form action=&quot;updateaction.cfm&quot; method=&quot;post&quot;>
<input type=&quot;Hidden&quot; name=&quot;ID&quot; value=&quot;#ID#&quot;><br>


The code in my updateaction file is:

<cfquery name=&quot;UpdateEvent&quot; datasource=&quot;Events&quot;>
UPDATE Events
SET
Title = '#form.title#',
PrintDesc = '#form.PrintDesc#',
InterDesc = '#form.InterDesc#',
IntraDesc = '#form.IntraDesc#',
Area = '#form.Area#',
location = '#form.Location#',
Ticketed = '#form.Ticketed#',
Kid = '#form.Kid#',
Handicap = '#form.Handicap#',
Category = '#form.Category#',
Subcategory = '#form.Subcategory#'
WHERE ID = #form.ID#
</cfquery>


When I try to test my form, I get the following error message:

An error occurred while evaluating the expression: <PRE> #URL.ID#</PRE>

Error resolving parameter <B>URL.ID</B>

Can someone tell me what I'm doing wrong? Thanks

 
By the looks of the error message you are not passing the URL.ID to the page so the query getEventtoupdate can't run as it does not have the value that is needed.

you need to have the ID value on the url for CF to be able to use it in this case. your url should look something like nameoffile.cfm?ID=2

 
I hate to sound stupid, but I'm new to this so here goes: where does the nameoffile.cfm?ID=2 go? My ID field in my main table is the primary key and is an AutoNumber type.

Thanks for you help.
 
the page that has got the query:

<cfquery name=&quot;GetEventtoUpdate&quot; datasource=&quot;Events&quot;>
SELECT *
FROM Events
WHERE ID = #URL.ID#
</cfquery>

needs to be padded a value for the #URL.ID# value so on a page before this you need to have something that passes this value to the page with this query on.

you could use this
<A href=&quot;pagewithqueryonit.cfm?ID=1&quot;>Click Me</A>

this would put the value of 1 onto the URL for the page with the query on to be able to read this from the url as you have specified.

so what you need is:

1) a page that passes the value of ID to the next page
2) the page that you have already that outputs the information from the query
3) your update page that will take any changes that you have made and commit them to the database

what you could do to see if the page is working correctly is just to put the following code onto the end of the url for the page with the select query on it:

?ID=1

so that your url should read something like

page.cfm?ID=1

hope this helps !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top