Hi all, Looking at creating an online form so people can send me info via my website. I am trying to code a very simple page but have and error when trying to call it. I am using dreamweaver that the form properties points to the PHP file which has the 755 permissions on the PHP file but when the PHP file is called I get a 405 Method Not Allowed, CGI was switched opn a while back, I suspect there is something wrong with my code so I have attached it below. <?php $emailSubject = 'New Membership Details'; $webMaster ='firstname.lastname@example.org;
There are a number of typos in your code, but it's easier to show you a version that works.
<?php $emailSubject = 'New Membership Details'; $webMaster ='email@example.com'; // $emailField = $_POST['email']; // commented out and replaced by next line ... $emailField = 'firstname.lastname@example.org'; // ... for convenience in this test $body = <<<EOD Email Address: $emailField<br> Subject: $emailSubject<br> EOD; $headers = "From: $emailField\n"; $headers .= "Content-type: text/html\n"; // you had 'test/html' here $success = mail($webMaster, $emailSubject, $body, $headers); echo $body,$success; ?>
Note: relying on $email being set from the name of the form field will work at the moment because register_globals is on. However it will stop working when that is turned off. So best not to rely on it; set values you need from the $_POST global as done above in your original code. I made use of the extracted variable later. David Edit: I should have mentioned I set permissions on that file to 700. The directory I put it in has permissions 710.