0

All,

In the code snippet below - I am trying to only send an e-mail if the page is reached via a POST request - the if statement is not being recognized in the CGI code - as when I access the page this is on directly - I get the print statement but I also receive the print after clearing the cache then going to my web form which calls this code. Is something off that is simple with this if statement:

if ($ENV{'REQUEST_METHOD'} eq 'POST') {
$to = "admin\@mysite.net";
$date = todays-date;

&Email
&Thanks;
&HTML;

}
else
{
print "This page cannot be accessed directly";
}
1
Contributor
1
Reply
12
Views
5 Months
Discussion Span
Last Post by koneill
1

All,
I think I might have fixed this by changing:
if ($ENV{'REQUEST_METHOD'} eq 'POST') {

to

if ($ENV{'REQUEST_METHOD'} eq "POST") {

thus adding double quotes around POST

Edited by koneill: typo

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.