| | |
Noobish
Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: May 2008
Posts: 3
Reputation:
Solved Threads: 0
So I'm having a bit of a problem with a CGI script. It runs fine, except for the little problem that param(x) doesn't work at all. It will either crash the program or return an undefined value.
Thanks
perl Syntax (Toggle Plain Text)
#!/usr/bin/perl use warnings; use CGI qw(:standard ); $temp=uc(param('class')); $class=chomp ($temp); $temp=uc(param('type')); $type=chomp ($temp); $temp=uc(param('first')); $first=chomp ($temp); $temp=uc(param('last')); $last=chomp ($temp); $temp=param('area'); $areacode=chomp($temp); $temp=param('firstnum'); $first3=chomp($temp); $temp=param('secondnum'); $last4=chomp($temp); $temp=uc(param('carrier')); $carrier=chomp($temp); $num="$areacode$first3$last4"; open (PER, ">../data/USERS/$type/$first.$last.dat"); print (PER "$first $last\n$class\n$num\n$carrier"); close (PER); print ("Content-Type:text/html\n\n"); print "<html><body>"; print '<h4>Thank you. Please email the Administrator at <a href="mailto:apcsci@gmail.com">xxxx@gmail.com</a> with any questions or comments</h4>'; print "</body></html>";
Thanks
start with a simple script. Use a form with one text field: 'test'.
if that still crashes then your install of perl is bad or is maybe a non standard distribution.
Perl Syntax (Toggle Plain Text)
#!/usr/bin/perl use warnings; use strict; use CGI qw(:standard); print header; print start_html; print param('test'); print end_html;
if that still crashes then your install of perl is bad or is maybe a non standard distribution.
Last edited by KevinADC; May 28th, 2008 at 5:54 pm.
•
•
Join Date: May 2008
Posts: 3
Reputation:
Solved Threads: 0
somehow theres a problem in the
part, and not regarding the param('x'); call. the simple form worked fine, and i modified my script so that it doesn't convert to uppercase or chomp, and now it's working
EDIT: Well now I feel really stupid. $first=chomp($temp); would return the number of spaces removed, not the string after the spaces had been removed. Oops haha
perl Syntax (Toggle Plain Text)
$temp=uc(param('class')); $class=chomp ($temp);
EDIT: Well now I feel really stupid. $first=chomp($temp); would return the number of spaces removed, not the string after the spaces had been removed. Oops haha
Last edited by scuba183; May 28th, 2008 at 10:11 pm.
![]() |
Similar Threads
- C++ graphics (C++)
- really noobish (C++)
- RandomJumbleOfLetters.exe (Viruses, Spyware and other Nasties)
- multiple file searching (C)
- repetition problem (C++)
Other Threads in the Perl Forum
- Previous Thread: How to open a .exe file in the foreground
- Next Thread: Modifying a Perl script for multiple lines of html...
| Thread Tools | Search this Thread |





