|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
typo!
clearly there's a typo in here:
%myhero = ("fname" =< "Donald", "lname" => "Duck"); should read %myhero = ("fname" => "Donald", "lname" => "Duck"); |
|
#2
|
|||
|
|||
|
Help!
Please help!!!
<br> <br> I saved the form from Perl 101 part 7 into a html file "getname.html" and here is the content: <br> -------------------------------------- <br> <html> <br> <head> <br> <basefont face=Arial> <br> </head> <br> <body> <br> <form action=http://host_ip#/cgi-bin/readform.cgi method=GET> <br> Enter your first name: <input type=text length=20 name=name><br> <br> <input type=submit value=Submit> <br> </form> <br> </body> <br> </html> <br> ---------------------------------- <br> and then I saved the CGI script that receives and processes the data. readform.cgi at the same location and here is the content of this file: <br> ------------------------------------ <br> #!/usr/bin/perl <br> <br> # readform.cgi <br> # reads form data and generates a page <br> <br> # for GET data <br> if ($ENV{'REQUEST_METHOD'} eq "GET") <br> { <br> $yourname=$ENV{'QUERY_STRING'}; <br> } <br> # for POST data <br> else <br> { <br> $yourname = <STDIN>; <br> } <br> <br> # Remove spaces if any <br> $yourname =~ s/\+/ /g; <br> <br> # split form data and store in hash <br> %details = split (/=/, $yourname); <br> <br> # generate page <br> print "Content-Type: text/html\n\n"; <br> print "<html><body>"; <br> <br> while (($name, $value) = each %details) <br> { <br> print "Thank you for your submission, $value!\n"; <br> } <br> <br> print "</body></html>"; <br> ------------------------------------ <br> <br> After doing this I pull the from on to a browser and type in the name "ASIF" and press enter and the result is: <br> <br> the URL field shows: <br> http://host_ip#/cgi-bin/readform.cgi?name=ASIF <br> the body of the browser shows: <br> HTTP 500 - Internal server error <br> <br> (of cause some other junk info above and below this error for MS IExplorer) <br> <br> My server is a NT 4.0 web server and I have active perl (stable ver) installed and I know it works coz I can use other pl scripts. <br> <br> Can someone help??? <br> <br> Thanks a million in advance <br> Asif <br> asift@netscape.net <br> <br> |
|
#3
|
|||
|
|||
|
use strict;
Your series is very informative.
Do any of the CGI installments include use strict; Along with -w of course? Thanks |
|
#4
|
|||
|
|||
|
Re: Help!
I found the problem....my web server did not know how to handle filename.CGI file - file association problem is now fixed
Asif |
|
#5
|
|||
|
|||
|
Get and Post
I have had a problem with POST. I think it might not be enabled. How do I check and if so How do I install or enable it.
|
|
#6
|
|||
|
|||
|
cgi
Thank you. Fun fun fun.
|
|
#7
|
|||
|
|||
|
param() ???
Why is it that every single perl form tutorial explains that god awful process for using <STDIN> and translating and substituting the value? Ever heard of the param() function? Its meaningless to even teach anyone this if they can just use param().
|
|
#8
|
|||
|
|||
|
Re: cgi
ditto
Thanks for your assistance. It is fun the first time a new language* is made to work. * new to me :) |
|
#9
|
|||
|
|||
|
Re: typo!
Another little one, but quite important I feel in the understanding of a new function:
On page 4, <!-- Code --> <p><pre><font color=#008000><xmp># get the names @year = keys(%director);</xmp></font></pre><p> <!-- Code --> should be <!-- Code --> <p><pre><font color=#008000><xmp># get the years @year = keys(%director);</xmp></font></pre><p> <!-- Code --> |
|
#10
|
|||
|
|||
|
Re: Get and Post
I think I have the same problem. Let me know if you fixed it
|
|
#11
|
|||
|
|||
|
Re: Get and Post
man i posted that nearly a year ago.
I dont even have apache installed any more. I'm not sure of what the problem turned out to be but the script sorta worked. The user could input some text and it got mailed to me but it didn't return to the page it was spose to after. Joe |
|
#12
|
|||
|
|||
|
Re: Get and Post
Thanks for replying anyhow. I'll figure it out.. I didnt look at the date (obviously). I have the same problem, It mails me the form results, but it doesnt redirect afterwards. It isnt mission critical anyway. Its my home pc.
do you use a different web server? Thanks, Paul Adams |
|
#13
|
|||
|
|||
|
Re: param() ???
Using CGI.pm is so much better, agreed. Everyone uses CGI.pm, it comes with your Perl distribution. There is no reason not to use it. Why write potentially flawed and insecure code when someone else has already done most of the work for you, better than you could, and more securely than you could, for the past few years?
|
|
#14
|
|||
|
|||
|
|
|
#15
|
|||
|
|||
|
|
![]() |
| Viewing: Dev Shed Forums > Other > Development Articles > Perl 101 (part 7) - CGI Basics |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|