View Full Version : ASP help needed

Heather P
23-12-2002, 08:35 PM
The books are out and I'm going round in circles.

I have a table of products in a database that populates a form.
Currently the form contains an input type of "checkbox" to hold the records. The name for each checkbox is the productID of the individual records.

This works.

I can pass the records one by one to a second page and read it. Does anyone have any ideas how to pass the checked records as a group? Arrays? Loops? Decisions? Can a variable hold more than one item of passed data?

(The trouble with help files and books is you need to know what you are looking for to find it!)

24-12-2002, 05:12 AM
Extracting a group of records sounds like something a report does.

Can you use a reporting style function to creaate the new data or is it being appended to something else? (existing table of data?)

Heather P
24-12-2002, 08:14 AM
The list is for a gift basket. Tick the products you want, click to a new page and the list appears with a total price. At which point you say "My God! THAT much?" and return to the previous page to de-select a few.

The trouble is all the examples I can find are for drilling down through a list eg a catalogue of books. All books appear and you select one for specific details.

I did a report a year ago (tech assignment) but that again drilled down using a set of specific topics.

I can probably do it using 50 IF statements but this is limiting the list to 50. There must be a loop statement using the ProductID - a sequential set of numbers.

Unfortunately ASP doesn't have a nice set of in-built reporting functions - you write your own in VBScript or Javascript.

(Which gives me food for thought. But speaking of food - I'd better go get some custard and cream before the store runs out).

24-12-2002, 08:29 AM
You can't just say:
select file.field, file.field, file.field
where checkbox = true
order by file.field

Sort of thing?

24-12-2002, 09:19 AM
Perhaps you need to create a recordset for the selected items and pass the recordset handle to the other page.

24-12-2002, 03:05 PM
I think I know what you need to do here:
1. Change the name of the checkbox to be the same name - say 'selected'.
2. Include a hidden control called 'pid' or something similar. Assign this control a value of your product id.
3. Now in your second page you can set up some arrays and do some 'splitting' to get your data into the arrays.

You'll need an array for the selections & one for the product ids so you can determine which product has been selected. Split each control name into each array.

Check out arrays ans the split function in VBScript for more info.

Good luck & Merry Christmas!