in reply to Form File Field

Appreciate the help! I am using it for an edit entry form. I will just use a text field to display it.

Replies are listed 'Best First'.
2Re: Form File Field
by jeffa (Bishop) on Sep 02, 2003 at 04:55 UTC
    But your text fields all share the same name, 'pic' ... maybe what you want is a radiobutton group:
      <form>
      Foo <input value="foo" type="radio" name="pic" /><br />
      Bar <input value="bar" type="radio" name="pic" /><br />
      Baz <input value="baz" type="radio" name="pic" />
      </form>
    
    Otherwise, your input fields should not share the same name.

    There are a couple of ways to make radio buttons in Perl without to much fuss ... the first is by brute force, much like you did in your question. However, since the "stuff" from your tab delimited file is already stored in the array @fields, we can iterate across the loop and not have to worry about whether or not we are dealing with the second index or the eleventh index:

    print "<form>\n"; for my $field (@fields) { print qq|<input value="$field" type="radio" name="pic" /><br />\n|; } print "</form>\n";
    CGI.pm has a very handy method for generating radio boxes:
    use CGI qw(:standard); print start_form, radio_group(-name => 'pic', -values => \@field), end_form, ;
    I recommend that you visit and read Ovid's online Web Programming with Perl course. You will learn a lot of good stuff there. :)

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)