I am setting up an EDIT BASKET page for the owner of the site so it will be easier for her to update the baskets herself online. Everything has been going well except for one hurdle. On the basket edit page, I have this
http://www.btkdesigns.com/basketupdate.gif (non live version)
http://www.btkdesigns.com/basketupdate2.gif (non live version)
Well, as you can tell from those pictures, I have an option for her to CHOOSE THE CONTENTS, depending on the basket. When they are taken to the Choose Contents page, I allow for the basketID to be passed from the page before using the basketID=#URL.basketID# code. When the owner gets to that page, they see something like this
http://www.btkdesigns.com/contentupdate.gif (non live version)
http://www.btkdesigns.com/contentupdate2.gif (non live version)
That drop box contains 190 different basket items. What I want is to have something like that row, but with about 19 more rows, making it 20 rows in total. If you noticed, I have included checkboxes. The idea here is that the owner can choose how many items she wants in the basket, up to 20. So she may want BEEF STICKS for the 1st item (1st row), and then she can choose a whole new item for the 2nd row, ect..
The check boxes are for when she is done, she check marks the rows where it contains the appropriate item, and then when submitted, only content that has been checked will be included in the database. So if she uses 15 of the 20 rows, only 15 will be included. I hope that makes sense.
The information would go into the Access database like such
http://www.btkdesigns.com/accessupdate.gif So it includes the fields, basketID and itemID. So the values basketID would be inserted from the previous page along with the "15" itemID's" the owner may have included from my example above.
Anyways, I guess I will show you the code of what I currently have.
TOP OF THE PAGE
<!--Check that basketID was provided-->
<!--If yes, edit, else add-->
<CFSET EditMode=ISDefined ("URL.basketID")>
<!--If edit mode, then get row to edit-->
<CFIF EditMode>
<!--Get the film record-->
<cfquery name="basket_items" datasource="something" maxrows="20">
SELECT basketID, basketname
FROM baskets
WHERE basketID=#URL.basketID#
</cfquery>
<CFQUERY name="content" datasource="something">
SELECT itemID, itemname
FROM content_list
ORDER by itemname
</CFQUERY>
<CFSET title="Content Items for -- #basket_items.basketname#">
<CFELSE>
<CFSET title="Please go back and specifiy a correct Basket!">
</CFIF>
BODY OF THE PAGE
<cfoutput>#title#</cfoutput></h2>
<span id="recordcount">There are currently <cfoutput>#content.RecordCount#</cfoutput> items.</span>
</td>
</tr>
<tr>
<td><table id="insert">
<CFFORM action="basket_content_edit.cfm">
<tr>
<td><b>Basket Item #</b></td>
<td><b>Basket Name</b></td>
<td><b>Items to add </b></td>
<td><b>Add</b></td>
</tr>
<br />
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr><CFOUTPUT query="basket_items">
<CFIF CurrentRow MOD 2 IS 1>
<CFSET rowcolor="rowcolor1">
<CFELSE>
<CFSET rowcolor="rowcolor">
</CFIF>
<tr class="#rowcolor#">
<td>#CurrentRow#</td>
<td>#basket_items.basketname#</td>
<td>
<select name="items"><cfloop query="content"><option value="#content.itemID#">#content.itemname#</option></cfloop>
</select>
</td>
<td><input type="checkbox" name="checkbox" value="checkbox" /></td>
</tr></CFOUTPUT>
</CFFORM>
I know some of my code may not be correct. As you can tell, in my schema on the top of the page, I tried to set the maxrows to 20, but once I threw in then CFLOOP statement in the SELECT area, it no longer wanted to output 20 rows, it only works with 1.
Thank you
Bryan