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";
}

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.