Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^6: Not getting form data from stdin (nms-cgi)

by Anonymous Monk
on Nov 07, 2014 at 11:01 UTC ( [id://1106475]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Not getting form data from stdin (nms-cgi)
in thread Not getting form data from stdin

Why are you using POSTDATA? Here is unclunky version
#!/usr/bin/perlml -- ## ## ## ## perltidy -olq -csc -csci=3 -cscl="sub : BEGIN END " -otr -opr -ce +-nibc -i=4 -pt=0 "-nsak=*" ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if " -otr -opr +-ce -nibc -i=4 -pt=0 "-nsak=*" ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if while " -otr + -opr -ce -nibc -i=4 -pt=0 "-nsak=*" #!/usr/bin/perl -- use strict; use warnings; use CGI (); use CGI::Carp qw( fatalsToBrowser ); use Mail::Sendmail qw/ sendmail /; Main( @ARGV ); exit( 0 ); sub Main { my $q = CGI->new; ## NONSENSE ## my @values = split /[\s=]+/, $q->param('POSTDATA'); #~ Send( split /[\s=]+/, $q->param('POSTDATA') ); Send( $q ); return print Thanks( $q ); } sub Send { my( $q ) = @_; my $from = $q->param( 'from' ); my $msg = $q->param( 'msg' ); my %mail = ( 'smtp' => "smtp.###.co.za", 'port' => 465, 'auth' => { user => '###@###.co.za', password => '###' }, To => '###@###.co.za', From => $from, Message => $msg, ); sendmail( %mail ) or die $Mail::Sendmail::error; } ## end sub Send sub Thanks { return $cgi->header, <<END; <html> <head> <title>Thank you for your message</title> <meta http-equiv="Content-Type" content="text/html; c +harset=utf-8" /> <meta http-equiv="Content-Language" content="en" /> <link rel="stylesheet" type="text/css" href="/css/gen +eral.css" /> <link rel="stylesheet" type="text/css" href="/css/tha +nks.css" /> </head> <body> <div id="header"> <img id="small-logo" alt="### Logo" src="/graphic +s/LogoSmall.jpg" height="80" width="80" /> <div id="nav"> <ul> <li><a href="/index.html">home</a></li> <li><a href="/about.html">about us</a></l +i> <li><a href="/products.html">products</a> +</li> <li><a href="/customers.html">customers</ +a></li> <li><a href="/gallery.html">gallery</a></ +li> <li><a href="/contact.html">contact us</a +></li> </ul> </div> </div> <div id="content"> <h1>Thank you for leaving a message</h1> <p>We will respond as soon as possible.</p> </div> </body> </html> END } ## end sub Thanks __END__

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1106475]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2024-04-23 10:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found