Welcome Guest ( Log In | Register )




                Web Hosting Guide

 
Reply to this topicNew 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 topicNew Topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts 7 Niru 4,418 20th February 2010 - 07:04 AM
Last post by: iG-suresh
No new   19 Feelay 9,084 18th February 2010 - 08:47 AM
Last post by: iG-Tsholofelo
No New Posts   10 Eggie 8,351 10th February 2010 - 06:47 AM
Last post by: iG-
No New Posts   6 Skepticus 175 7th February 2010 - 02:16 AM
Last post by: 8ennett
No New Posts   0 8ennett 57 30th January 2010 - 11:10 PM
Last post by: 8ennett
No new   25 JohnNitro 15,316 26th January 2010 - 11:30 AM
Last post by: iG-mdshare
No New Posts   3 wutske 1,189 18th December 2009 - 07:36 AM
Last post by: iG-anil kumar
No new   23 TavoxPeru 13,040 6th December 2009 - 01:38 PM
Last post by: iG-Alex Finney
No New Posts  
4 PHP
7 bluefish 3,104 3rd November 2009 - 09:29 PM
Last post by: HannahI
No New Posts   10 yordan 2,527 27th October 2009 - 11:31 PM
Last post by: HannahI
No New Posts 15 rantsh 4,594 16th October 2009 - 08:34 AM
Last post by: iG-Amit Verma
No New Posts   2 pbolduc 3,539 3rd October 2009 - 08:20 PM
Last post by: iG-Andrew
No New Posts   11 soleimanian 5,126 22nd September 2009 - 12:01 PM
Last post by: iG-
No New Posts   7 Eggie 2,567 9th September 2009 - 02:22 AM
Last post by: iG-nate
No New Posts   12 m3th 8,007 29th August 2009 - 12:16 AM
Last post by: dmnhunter


Web Hosting Powered by ComputingHost.com.
HONESTY ROCKS! truth rules.
Creative Commons License