Collecting Web Form Information Using a Loop

Mike Bonner bonnmike at gmail.com
Wed Sep 1 12:47:46 EDT 2010


use a for each loop instead like

repeat for each key theKey in $_POST
    put $_POST[theKey] & comma after theSubmission

end repeat

On Wed, Sep 1, 2010 at 10:39 AM, Michael Kann <mikekann at yahoo.com> wrote:

> Gregory,
>
> Does the non-loop script work?
>
> -- referring to this part:
>
>     put $_POST["Q1"] into q1
>     put $_POST["Q2"] into q2
>
> Mike
>
>
>
> --- On Wed, 9/1/10, Gregory Lypny <gregory.lypny at videotron.ca> wrote:
>
> From: Gregory Lypny <gregory.lypny at videotron.ca>
> Subject: Collecting Web Form Information Using a Loop
> To: "Revolution" <use-revolution at lists.runrev.com>
> Date: Wednesday, September 1, 2010, 11:34 AM
>
> 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?
>
>
> Regards,
>
> Gregory
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list