Okay what I've got is a form and an array with a list of courses. The array populates a drop down list, I also have on the form a cost text box. What I would like is when the user chooses a course the cost field to automatically bring the price that matches the course (without clicking on any buttons). I am trying to do this in classic ASP and cannot use Javascript.

Can someone please help me....thanks

compare dropdownlist.selecteditem to the course and fiil in the text box.check the command cause am not quit sure about it but it must be similar to it.

Okay what I've got is a form and an array with a list of courses. The array populates a drop down list, I also have on the form a cost text box. What I would like is when the user chooses a course the cost field to automatically bring the price that matches the course (without clicking on any buttons). I am trying to do this in classic ASP and cannot use Javascript.

Can someone please help me....thanks

populate the list....
post the form back to the same page with value from the list
and get the value corresponding to the list value using sql query....
i am working on the code...


Originally posted by aashishn86
populate the list....
post the form back to the same page with value from the list
and get the value corresponding to the list value using sql query....
i am working on the code...

The only thing is I have not stored courses in a database they are in an array.

That's fine that courses are in an array, but where are the cost stored.

Moreever, if you want to do something on user selection, then either you will need to post your page back to server or you will need to use AJAx.

Hi akhtarr, if you have physically entered the courses to an array, then create a multi-dimenion array which means you just add the value of the course into the array as you would normally do only now you are adding another value to it.

i.e.

dim arrayName()
' only necessary if drawn from database 
redim arrayName(course_number)

' add the values
arrayName(0) = course_name1 & "," & course_price1
arrayName(1) = course_name2 & "," & course_price2

You can retrieve these values in the same fashion as you would to populate the drop down box (select statement).

Hi TomBCullen
Thanks Your post was really helpful! I have created a multi dimensional array and it is working. Thank you very much!!

Your welcome, I am glad to help.

If there are any more issues you need assistance with, just let me know.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.