Thread: Insert issue?
View Single Post
  #8 (permalink)  
Old June 15th, 2005, 02:09 PM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 33,170, Level: 79
Points: 33,170, Level: 79 Points: 33,170, Level: 79 Points: 33,170, Level: 79
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,161
Thanks: 7
Thanked 188 Times in 186 Posts
Default

Quote:
quote:Hi Imar - wow! quick response on that one.
Depends on the time of the day you post your question.... ;)

Anyway, try this simple example; this may just be what you need.

Imar

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%
  If Request.Form("lstCategory") <> "" Then
    Dim category
      For Each category In Request.Form("lstCategory")
        Response.Write("INSERT INTO SomeTable (SomeColumn, TheCategory) VALUES('SomeValue', " & category & ")<br />")
      Next
    End If
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Test Loop Insert</title>
</head>

<body>
  <form method="post" action="PutTheBoxInTheFreezer.asp">
    <select name="lstCategory" multiple="multiple" size="5" style="width: 75px;">
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
      <option value="5">5</option>
    </select>
    <input type="submit" value="Click me" />
  </form>
</body>
</html>
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote