Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Perl Script
ezincenter
post Dec 10 2004, 11:30 PM
Post #1


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 20
Joined: 30-October 04
From: morocco
Member No.: 1,286



Hey everyone, got a problem with a Perl script I'm trying out. In my Perl script, I have the user input a number to dynamically display a number of text form fields in which they enter figures. At the bottom, there will be a button to give the sum of all the numbers in the text fields--that's where I'm stuck, I got the text boxes to show up alright, but that's about it. I thought I might use JavaScript, but that didn't turn out to well. I was thinking of using arrays for the name referencing in the javascript part, but I couldn't figure that out either. Here's the script
Code:
QUOTE

#!/usr/bin/perl -w
use CGI;
$query = new CGI;
$JSCRIPT=<<EOF;
// Any JavaScript Ideas??
EOF
;
print $query->header,"\n";
print $query->start_html(-title=>'JavaScript Summations',-script=>$JSCRIPT),"\n";
print "<h1>Choose to add up a Summation of costs</h1>\n";
print $query->p,
"Just enter in the number of items you will need to include then hit &quot;Submit Query&quot; to get the form boxes","\n";
print $query->start_form(-name=>'formA',
-method=>'get'),"\n";
print "<p>How many items?\n";
print $query->textfield('item'),"<br />\n";
print $query->submit,$query->reset,"</p>\n";
$list = $query->param('item');
print "<ol>\n";
for (1..$list) {
print qq{  <li>Input a cost(\$): <input name=\"field$_\" type=\"text\" /></li>\n};
}
print "</ol>\n\n";
print "<input type=\"button\" value=\"Get Sum\" onclick=\"doSum()\" \/>\n\n";
print $query->end_form,"\n\n";
print $query->end_html;


This is like my second serious Perl script and I couldn't think of the syntax that would accomplish my task--I wouldn't even know how to search for it really, but I'll continue to play around with ideas. Thanks, in advance, for any help.

Best regards,
ezincenter
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Perl, the hacker language?(6)
  2. What Is Perl?(11)
  3. Does Anyone Know To Use Movabletype (perl)(6)
  4. Perl : Help(4)
  5. Simple Problem W/ Perl(5)
  6. Sockets And Perl(1)
  7. Best Place For Information On Perl(8)
  8. Password Reminder And Password Change .htaccess(4)
  9. Strange Perl Behavior(4)
  10. Perl: Exec Or System ?(3)
  11. Help Needed To Create Login Script With Perl/cgi(21)
  12. Create Easily Modifiable Html Templates For Use In Your Perl Cgis(0)
  13. Share Your CGI Scripts Here(1)
  14. Using Perl For Newsletter Subscription(1)
  15. Simple Perl Script...(1)
  1. Need To Install Script - $10(5)
  2. Just Learning Perl(6)
  3. Perl Programming Language(1)
  4. Maximum Number Of Decimal Places In Perl Language(0)


 



- Lo-Fi Version Time is now: 22nd November 2008 - 03:56 PM