Request() dilemma...

Results 1 to 3 of 3

Thread: Request() dilemma...

  1. #1
    Join Date
    Dec 1969

    Default Request() dilemma...

    Hi all,<BR><BR>I expect that this is quite simple.<BR><BR>I have a form that allows a user to select and input various ports, arrival/depart times and notes regarding whatever cruise holiday that user wishes to amend. The form elements are populated on the page based on how many nights the cruise is plus one. So a 14 night cruise would generate 15 select boxes, one for each day - each populated with about 100 ports from a database. In addition to the select boxes, there are hidden inputs too which when selected from the pulldown become visible to allow the user to enter any additional ports that don&#039;t appear in the list.<BR><BR>To avoid confliction, within the form element generating loop, I&#039;ve assigned the number of that day to the select box and input names like so: name="portSelected1" name="portAdded1. Up until the maximum number of nights.<BR><BR>Now on the next page, I&#039;ve created an If statement to check if any additional ports have been added, if they have, replace the original value "addPort" with that of the one typed in by the user. which is fine.<BR><BR>I want to now convert these values into one string that can be stored in one database cell in a similar format to the way the arrival/depart times and the notes have been requested in.<BR>ie. notes = Request("notes") would look like this in a browser:<BR>note1, note2, note3, note4 etc...<BR>Because they all share the same form element name.<BR>This is what I want the requested/sorted ports to look like, but it&#039;s proving quite difficult beacause their names are unique.<BR><BR>Some code:<BR><BR>Dim night_num<BR>night_num = Request("nights")<BR><BR>&#060;%<BR> Dim result<BR> Dim i, n<BR> i = 0<BR><BR> For n = 1 to night_num + 1<BR> If i &#060; n Then<BR> i = i + 1<BR> If Request("portSelected" & i) = "addPort" Then<BR> result = CStr(Request("portAdded" & i))<BR> Else<BR> result = CStr(Request("portSelected" & i))<BR> End If<BR> End If<BR> Next<BR>%&#062;<BR><BR>Any help will be much appreciated!<BR><BR>Wayne

  2. #2
    Join Date
    Dec 1969

    Default RE: Request() dilemma...

    I don&#039;t think you can do this:<BR><BR>Request("portSelected" & i)<BR>try just:<BR>Request("portSelected")

  3. #3
    Join Date
    Dec 1969

    Default You'd be wrong

    you can do that but I think what is being attempted is a bad idea. If I understand this right you want to concatenate together all ports into one string and then insert it? Then you want to know what doesn&#039;t match when a change is made? Very bad idea if I understand correctly. You want to store each selection as a row this way you can more easily query for what has changed. Storing data concatenated together is seldom (if ever) a good idea.

Posting Permissions

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