help with request.form

Results 1 to 2 of 2

Thread: help with request.form

  1. #1
    Join Date
    Dec 1969
    Posts
    940

    Default help with request.form

    Ok. Here goes. I have a form on which there is a selection list of names, the names have numerical values in the selection list. Like this:<BR><BR>&#060;select size="5" name="test" multiple&#062;<BR>&#060;option value="1"&#062;Name1&#060;/option&#062;<BR>&#060;option value="2"&#062;Name2&#060;/option&#062;<BR>&#060;option value="3"&#062;Name3&#060;/option&#062;<BR>&#060;option value="4"&#062;Name4&#060;/option&#062;<BR>&#060;option value="5"&#062;Name5&#060;/option&#062;<BR>&#060;/select&#062;<BR><BR><BR>This is a multipick selection list. My problem is this. When someone selects more than one name the result of request.form("test") is a comma delimited list. Like this: 1,2,3,4 I need to insert into the database one record for each item selected. So if they select name1, and name2, and name3 then I will need to insert three times. My problem is that I don&#039t know how to handle this. The values are not always going to be only one digit long. They can be upto 7 or so. Please provide some help, and code that will help me with this one. Thanks,<BR><BR>Eric

  2. #2
    Volker Guest

    Default RE: help with request.form

    Hey my dear :-)<BR>I don&#039t know if there is a simpler solution, but I would do this:<BR>just parse your result-string with the comma as the delimiter, so you have something like this:<BR>result = request.form("test")<BR>pos1 = 0<BR>pos2 = InStr(result, ",")<BR>while (pos2 &#060;&#062; 0) <BR> value = mid(result, pos1, pos2-pos1) &#039This is now one of your returned values<BR> pos2 = InStr(pos2+1, result, ",")<BR>wend<BR><BR>hope this helps<BR>Volker

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •