Creating a variable using a for() loop???

dayton_at_gecko.org
Date: 03/26/05

  • Next message: Jürgen Exner: "Re: Creating a variable using a for() loop???"
    Date: 26 Mar 2005 12:05:43 -0800
    
    

    I have a form that is dynamiclly generated from a database. Using the
    CGI module, I'm trying to parse the parameters returned, but since the
    number of paramaters changes I can't get the variables assigned...

    What I'm trying:
    --------------
     $count='1';
                    while (my(@data)=$table_data4->fetchrow_array) {
                            print qq|
                            <tr><td><input name=rs$count type=text
    maxlength=7 size=7 value=$data[0]><td>$data[1]
                            |;
                            $count++;
                    }
    --------------------

    which correctly populates the table but then when I try to parse the
    parms..

    (like : if (param()){ $buh = param('buh') || '';}

    I run into my problem. I've tried:

    ----------------------
    for ($i=1;$i<=$number;$i++)
          $R$i="rs$i";
    }
    ----------------------

    and the error I get is:

    Scalar found where operator expected at ./test line 5, near "$RS$i"
            (Missing operator before $i?)
    syntax error at ./test line 5, near "$RS$i"
    Execution of ./test aborted due to compilation errors.

    How can I auto-generate the variables based on the # of params created
    by the form?


  • Next message: Jürgen Exner: "Re: Creating a variable using a for() loop???"

    Relevant Pages

    • Re: Parsing and storing formulas
      ... you could easily store different views/stored ... >I was wondering how I can parse a mathematical formula in a storable way. ... > be stored for in the database. ... > The second idea is to represent the formula as a tree. ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: Using a for() statement to create a variable??
      ... > I have a form that is dynamiclly generated from a database. ... > CGI module, I'm trying to parse the parameters returned, but since the ... please see the FAQ and google. ...
      (comp.lang.perl.misc)
    • Re: Running queries on large data structure
      ... |> nested data structures and allows the user to run quick queries on the ... | the users need to run queries on that within seconds. ... | ugly to convert it into some relational shape for the database) ... | (Read the data every now and then, parse it, write the nested Python ...
      (comp.lang.python)
    • Re: inputing, paging, sorting, a large text file
      ... To recreate it I need to parse the text again, ... I want to display the formatted columns to the user before submitting ... the database (perhaps allowing them to edit some fields if they want, ... How can I page the data in the grid, without having to parse the text ...
      (microsoft.public.dotnet.framework.aspnet)
    • Re: Back Again - RPM using a more efficient database format
      ... Back Again - RPM using a more efficient database format ... XML parsing is also not exactly a light task. ... was to do with it being faster to parse ... Isn't it more practical and efficient rather than using a SQL based database? ...
      (Fedora)