Collecting Web Form Information Using a Loop

Gregory Lypny gregory.lypny at
Wed Sep 1 12:34:00 EDT 2010

Hello everyone,

On-rev question about collecting web form information.  Suppose I have a questionnaire that uses 40 sequentially named menus for the answer choices.  I could collect them individually like this.

	put $_POST["Q1"] into q1
	put $_POST["Q2"] into q2
	put $_POST["Q3"] into q3
	put $_POST["Q4"] into q4
	put $_POST["Q5"] into q5
	put $_POST["Q40"] into q40

But of course my first inclination is to avoid 40 lines and use a loop.  So I tried

	repeat with i=1 to 40
	put $_POST[(quote & Q & i & quote)] & comma after theSubmission
	end repeat

and a number of variations, such as,

	(quote & Q & the value of i & quote)

but all I ever get returned is an empty list, i.e., {,,,,,,,,,,,,}.  Any suggestions?



More information about the use-livecode mailing list