Counters in variable names.

From: Gary (reachus_at_netlink.info)
Date: 03/22/04

  • Next message: dw: "Re: Counters in variable names."
    Date: Sun, 21 Mar 2004 20:17:35 -0500
    
    

    My HTML reads a file and writes out field names to include a counter so I have fields like

    <input type=text name=surname$counter><input type=checkbox name=update$counter>

    When they click update these fields are sent to the update program for update.

    If the person changes this field they will also tick the change checkbox and I want to be able to loop through all the fields and update them as below

    UPDATE Program
    for($counter=0 ; $counter < $totalrecords ; $counter++)
    {
    if ($update$counter)
    { blah blah}

    The problem is that Perl does not seem to like me adding a variable ($counter) to a variable name ($update) and the only other way would be long winded like
    if ($update1) {Blah Blah}
    if ($update2) {Blah Blah}

    How can I get a variable to be part of anothers variable name.

    G


  • Next message: dw: "Re: Counters in variable names."

    Relevant Pages

    • Re: Counters in variable names.
      ... >My HTML reads a file and writes out field names to include a counter so I ... >If the person changes this field they will also tick the change checkbox ... >UPDATE Program ...
      (comp.lang.perl)
    • Re: A lousy page produced with M$-ware (was: Its not that bad)
      ... Please try to use standards compliant software because some ... Blah blah blah, do you have a site helping newbies ... out with electronics, or maybe HTML? ...
      (sci.electronics.design)
    • Re: Include another html file/content
      ... Now each html page is something like this: ... So when I want to change my address or logo graphics I have to go through every ... A simple way to accomplish this is by use of PHP. ...
      (comp.infosystems.www.authoring.html)
    • Re: HOWTO: Make some text hover over everything else
      ... Kiosk browser that embeds either IE7, ... I can handle all the DOM code to insert HTML into the current page, ... Blah blah ... Half lies are worth twice as much as whole lies. ...
      (comp.infosystems.www.authoring.html)
    • Displaying User Inputed HTML in a Form
      ... I'm trying to create an e-mail program for the back-end of my system. ... I want the users (a few educated staff members) to be able to put HTML ... blah blah blah. ...
      (comp.infosystems.www.authoring.cgi)