Wolverine68 Posted June 4, 2011 Share Posted June 4, 2011 I created a form using the mail() function. Upon submission, it's just suppose to email the information entered. Instead, I get the error "HTTP Error 405 - The HTTP verb used to access this page is not allowed." <body> <?php $recipient = "me@yahoo.com"; $subject = "Registration Submission"; $body = "<h2>Registration Information:</h2>"; if(!empty($_POST['name']) && !empty($_POST['email']) && !empty($_POST['question'])) { $body .= "\r\nName: " . $_POST['name']; $body .= "\r\nEmail: " . $_POST['email']; $body .= "\r\nQuestion: " . $_POST['question']; } if (mail($recipient, $subject, $body)) { print("Email successfully sent!"); } else { print("The email could not be sent."); } ?> <form method="POST" action=""> <h2 align="center">Sending Email</h2> <br /> <div> <p>Enter your name and email address, a question, and click "Submit":</p> <br /> <p>Name:<input type="text" name="name" size="20"></p> <p>Email:<input type="text" name="email" size="20"></p> <p>Question:<input type="text" name="question" size="20"></p> </div> <br /> <div> <input type="submit" name="submit" value="Submit" /> </div> <br /> <div> <input type="reset" name="Reset" value="Start Over" /> </div> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
monkeytooth Posted June 4, 2011 Share Posted June 4, 2011 405 is "Not Allowed" meaning the server is blocking it. I'm gonna go out on a limb and make an assumption that your using Godaddy as your hosting provider? Thats my first guess at least. Cause at the moment (though I could be overlooking something..) everything looks sound. Quote Link to comment Share on other sites More sharing options...
Wolverine68 Posted June 4, 2011 Author Share Posted June 4, 2011 My webhost is Ripway, http://www.ripway.com I have a free account but it says PHP scripting is supported. Got any other recommendations of web hosts that offer a free account with PHP support? Quote Link to comment Share on other sites More sharing options...
WebStyles Posted June 4, 2011 Share Posted June 4, 2011 Just uploaded that script to my server and it worked fine. so I uploaded to my godaddy server and also worked fine (godaddy takes 10 times longer to deliver emails though) Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted June 4, 2011 Share Posted June 4, 2011 Do any other form scripts using $_POST work? Quote Link to comment Share on other sites More sharing options...
monkeytooth Posted June 4, 2011 Share Posted June 4, 2011 I know nothing about your hosting company. Nor do I know many free hosting companies (cept myself but thats usually friends/family). Also its worth mentioning that just cause PHP is supported doesnt mean it has all its functionality available often hosts will block some of the functionality of PHP like godaddy for example used to block the mail() function entirely and you had to do mail via form through 3rd party or there means of handling mail. Personally my host of choice and has been for a few years running is HostGator cheap, fairly friendly and all around not bad of a service for what they offer, and compared to its competion its a lot better then most of them. But they don't have free acccounts Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted June 4, 2011 Share Posted June 4, 2011 I've used GoDaddy on and off for years, and I've never had a problem with mail(). If you Google this error, it seems to be a common occurrence with WinD'ohs Server running IIS 6. Something to do with file compression problems, from what I gather after a cursory look. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.