You could try to include the form into the cfoutput tags, so that each
product would have it's own editing form. Here's a rough idea of what i'm
saying:
<CFQuery name="GetProducts" datasource="#Application.ds#">
SELECT ProductID,
CategoryID,
ProductName,
Description,
Price,
Weight
FROM tblProducts
</cfquery>
<CFOutput query="GetProducts">
<Form method="post" action="UpdateProduct.cfm">
<Table>
<TR>
<TD>Product Name:</TD>
<TD><input type="text" name="ProductName" value="#ProductID#"
size=20></TD>
</tr>
<TR>
<TD>Description:</TD>
<TD><textarea cols=30 rows=2 wrap="virtual"
name="Description">#Description#</textarea></TD>
</tr>
<TR>
<TD>Price:</TD>
<TD><input type="text" name="Price" value="#Price#" size=5></TD>
</tr>
<TR>
<TD><input type="hidden" name="ProductID" value="#ProductID#"></TD>
<TD><input type="submit" value="Update #ProductName#"></TD>
</tr>
</table>
</form>
</cfoutput>
...This way, whichever row you edit, once you hit enter, it will submit the
contents of the form on that row only. That allows you to avoid the hassles
of naming. The other oprion would be to include #GetProducts.CurrentRow# as
part of the field names to produce a different field name for each row of
the query...
Hope this helps..
-----Original Message-----
From: Chris Farrugia [mailto:[EMAIL PROTECTED]]
Sent: Saturday, August 05, 2000 11:40 PM
To: [EMAIL PROTECTED]
Subject: Help with updating a database
Good day,
I am creating the site for my computer store, where a user will be able to
custom configure a new PC. Currently I am stuck creating an administration
page where I can update the prices in my database. The table has fields
(ProductID, CategoryID (Hard Drive, Motherboard, etc), Description, Price,
Weight). I want on the admin page for there to be all of the products
listed in form text boxes. If I want to edit one, I can change the content
of that text box and then hit the submit button and it edits the database.
The problem I'm running into is that I can't name the form fields the same
thing because then it won't know which to edit... Can anybody explain how I
would do this? I am very new to coldfusion. Thank you for the help.
Sincerely,
Chris Farrugia
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.