Help with ASP Arrays

help writing thre arrays

Page 1 of 1

1 Replies - 2088 Views - Last Post: 30 August 2006 - 07:09 PM Rate Topic: -----

#1 kifeda  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 30-August 06

Help with ASP Arrays

Posted 30 August 2006 - 06:54 PM

Hello All,

I'm having some trouble with an array. I'm have three list which I'm trying to insert into a database:

Here is an example of what the list would look like:
IngredientID List: 8,8
QuantityID List: 64,64
MeasurementID List: 60,60

As you see, I have three stes of values which I have successfully taken the ingredienIDs, the quantityIDs, and the MeasurementIDs from a drop list and put them in a hidden form. So I have three hidden forms: a form that contains the list of ingredientIDs, one for the list quantityIDs and one for the list of measurementIDs. The list of the ids vary depending on how many ingredients you choose to add to the recipe so if the recipe has 10 ingredients, you would select ten from the first drop down, and then the page would reload to show ten rows of three sets of drop downs. The drop downs are the ingredients (which I take the value ingredientID), the quantity of the ingredient (which I get the quantityID), and the measurement of the ingredient (which I get the measurementID from). The values all go into the hidden forms I mentioned above.

With me so far? I hope so!

So the first page is fine, I think. All I want from that page is the correct list of the IDs and I've got that.

So when you hit submit, it goes to a page I call process.asp and it is supposed to enter the list of IDs into the database at one time. Specifically, if the recipe had ten ingredients, it's supposed to enter 10 rows into the table: one row for each ingredient, and three values: the measurementID, the ingredientID, and the quantityID.

Here is my code for the process.asp page:
<!--#include file="Connections/ConnStudioApp.asp" -->
If Request.Form("submit") = "CONTINUE" Then
	'read the list of questions
	listOfIngredients  = Split(Request.Form("ingredientIds"), ",")
	listOfQuantities = Split(Request.Form("quantities"), ",")
	For i = 0 to UBound(listOfQuantities)
			quantity = Request.Form("q_" & listOfQuantities(i))
	'For i = 0 to Ubound(listofQuantities)
			'quantity = Request.Form("q_" & listOfQuantities(i))
	 author = request.form("author")
	 measurement = 9
	 'quantity = 4
	 ingredients = 5
	 response.write quantity & "<br>"
		'insert question id and answer into the database
		insertStmt = "INSERT INTO ingredients_recipes (ingredients, measurement, quantity) values (" & ingredients & "," & measurement & "," & quantity & ");"
		'objConn.Execute insertStmt
End If

what am I doing wrong? Please help!!!

Is This A Good Question/Topic? 0
  • +

Replies To: Help with ASP Arrays

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 250
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Help with ASP Arrays

Posted 30 August 2006 - 07:09 PM

Before we can tell you what the solution may be, you'll have to specify the problem you are encountering. Is that array not loaded after the split? Is the concatenation not occurring? Are you getting an error message?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1