Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting multiple data into multiple rows...

Status
Not open for further replies.

WaZiR006

Technical User
Oct 20, 2000
11
0
0
CA
Hi There,

Here is my sit:

Im trying to add multiple values coming out of a drop down list in a form, to go into multiple rows in a SQL table. For example, one value per row.

Lets say i have a drop down list with 3 options (aa, bb, cc) and i want to insert it in a table so it goes like:

ID value
1 aa
2 bb
3 cc

So i want to limit the inserting to one value per row, and i want it to submit it till its done with all the values (creating multiple rows with diffrent values in field "value")

How do i go about doing this? Your help is greatly appreciated!! :)


Brad
 
Oops, by dropdown list i meat using option &quot;<select Multiple name=&quot;list&quot;>&quot; where it allows you to pick multiple value... So for the name &quot;list&quot; i get out multiple values.

is it doable ?? :)
 
Ok, if I all anderstand, you have already on the form page :

<select name=&quot;list&quot; multiple>
<option value=&quot;aa&quot;>Value 1
<option value=&quot;bb&quot;>Value 2
<option value=&quot;cc&quot;>Value 3
</select>

if you select the tree options, you have on the action page for the variable list (form.list) the following value :

<cfoutput>#list#</cfoutput> ==> aa,bb,cc

If you want insert each value separate on a SQL table, you can loop on the list :

<cfloop index=&quot;val&quot; list=&quot;#list#&quot;>
INSERT INTO table (value) VALUES (#val#)
</cfloop>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top