|
|
|
| Web Hosting Guide |
![]() ![]() |
Perl Script |
Dec 10 2004, 11:30 PM
Post
#1
|
|
|
Newbie [ Level 2 ] 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 "Submit Query" 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 |
|
|
|
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
7 | Niru | 4,418 | 20th February 2010 - 07:04 AM Last post by: iG-suresh |
|||
![]() |
19 | Feelay | 9,084 | 18th February 2010 - 08:47 AM Last post by: iG-Tsholofelo |
|||
![]() |
10 | Eggie | 8,351 | 10th February 2010 - 06:47 AM Last post by: iG- |
|||
![]() |
6 | Skepticus | 175 | 7th February 2010 - 02:16 AM Last post by: 8ennett |
|||
![]() |
0 | 8ennett | 57 | 30th January 2010 - 11:10 PM Last post by: 8ennett |
|||
![]() |
25 | JohnNitro | 15,316 | 26th January 2010 - 11:30 AM Last post by: iG-mdshare |
|||
![]() |
3 | wutske | 1,189 | 18th December 2009 - 07:36 AM Last post by: iG-anil kumar |
|||
![]() |
23 | TavoxPeru | 13,040 | 6th December 2009 - 01:38 PM Last post by: iG-Alex Finney |
|||
![]() |
7 | bluefish | 3,104 | 3rd November 2009 - 09:29 PM Last post by: HannahI |
|||
![]() |
10 | yordan | 2,527 | 27th October 2009 - 11:31 PM Last post by: HannahI |
|||
![]() |
15 | rantsh | 4,594 | 16th October 2009 - 08:34 AM Last post by: iG-Amit Verma |
|||
![]() |
2 | pbolduc | 3,539 | 3rd October 2009 - 08:20 PM Last post by: iG-Andrew |
|||
![]() |
11 | soleimanian | 5,126 | 22nd September 2009 - 12:01 PM Last post by: iG- |
|||
![]() |
7 | Eggie | 2,567 | 9th September 2009 - 02:22 AM Last post by: iG-nate |
|||
![]() |
12 | m3th | 8,007 | 29th August 2009 - 12:16 AM Last post by: dmnhunter |
|||
|
Lo-Fi Version | Time is now: 12th March 2010 - 08:10 PM |
© 2010 AstaHost: Free Web Hosting & Technical Discussion, Free Web Hosting. a member of xisto.
Powered by Invision Board. Skin: IPB Forum Skins
Expand / Collapse Navigation



Dec 10 2004, 11:30 PM






