Link to home
Start Free TrialLog in
Avatar of robrodp
robrodpFlag for Mexico

asked on

Update database with asp when setting option on select

I have a script that has 2 multiple selects

<select multiple>
</select>

When the form is submitted it runs a script depending on the values of the select options selected.

Now.

The select options are created accesing a database.

The first one is quite simple. Open a table, scan the values for the <select multiple></select>

The tricky part is:

The second select scans a recordset  but the sql query depends on the values set on the first select.

Say the first select has students and the second has subjects, we want to select from all the students (one or more) in the first <select name="students" multiple></select> and in the second open a record set like:

select * from subjects,students where students.ok=1 (assuming the students table has an ok field which is set in the first select)

What is required is that when a value is set (on or off) in the first select the table of students is updated with ok=1 (is set on) or ok=0 (if set off).

I realize that javascript will run a js function with the onchange event. But I have no Idea if how to change the databse values (first select. update students set ok=1 where...)

Of course the whole purpose is to not run the form in order to update the vaues and then populate the second <select name="subjects" multiple></select>.

I need it to be a one step script.

The two <select></select> are in a form that when submitted it runs a script that uses the data from the values set in the form.
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of robrodp

ASKER

Exaclty what I was looking for Thz