ODBiC Discussion Board


RE: Using "Multiple" with the <option> command, Max Steiner, 11-04-2006

Use EACHMULTI

by Roger Harris, November 4, 2006 14:44

The EACHMULTI loop allows you to process a set of variables that have the same name, one at a time:

<% EACHMULTI $sections$ %>
... Inside the loop, $sections$ is set to one instance of the SELECT NAME="sections" input.
... The loop continues as many times as there are inputs with that name.
<% ENDMULTI %>
EACHMULTI was originally designed specifically for processing SELECT MULTIPLE inputs, but it works for any other type of inputs that have the same name (e.g. you could put a table of text input fields in a form that all have the same name). It also works with a list of variables (e.g. <% EACHMULTI var1, var2, var3, ... %>), which will let you work with the first instance of each variable inside the loop, then the second instance of each, etc., so you could define a two-dimensional table of inputs in a form, with columns of variables that all have the same name. The SETMULTI command lets you set multiple instances of a variable (i.e. each time it is used, it creates a new variable with the same name instead of resetting the value of a single variable, as SET does). The variables set with SETMULTI can then be processed later with an EACHMULTI loop. This gives the basic functionality of array processing without using subscripting.



Replies:


Post Your Reply:

Name   
E-mail  optional
Topic  
Message:

HTTP Link: 
Link text: 

          


Copyright ©1997-2003, Roger Harris. All rights reserved.