Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is this possible?

Status
Not open for further replies.

Kijori

Technical User
Jan 22, 2002
67
SG
i have a situation here. i have a web form with a few textfields displayed initially. there'll be a button to add more textfields to the existing ones using innerHTML. i intend to have the same element name for all textfields, eg.

<input type='text' name='something' value='somevalue'>

i don't want to have unique names as it would be tedious to assign variables to all of them individually.

i haven't tried it yet but is this possible?

use CGI;
$q = new CGI;

@textValue = $q->param('something'); #common for all

 
Code:
#!/usr/local/bin/perl
use CGI;
my $cgi = new CGI;
  print $cgi->header,
    $cgi->start_html;

if (!($cgi->param('submit')))
  {
  print $cgi->start_form,
    qq(  <textarea name='a1'  rows='3' cols='65'>
      first text area |</textarea><br>
      <textarea name='a1'  rows='3' cols='65'>
      second text area |</textarea><br>
      <textarea name='a1'  rows='3' cols='65'>
      third text area</textarea><br>
      <input type='submit' name='submit' value='submit'>),
  $cgi->end_form;
  }
else
  {
  @vars = $cgi->param('a1');
  print &quot;<pre>VAL of a1: <@vars></pre>&quot;;
  }
print $cgi->end_html;
'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top