Wolverine68 Posted May 7, 2011 Share Posted May 7, 2011 Created a simple html form. Upon submission, it's suppose to email the information entered in the form to the designated recipient. Instead, I get the error "The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access. " -------------------------------------------------------------------------------- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Mail Function</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <?php $recipient = "me@yahoo.com"; $subject = "Registration Submission"; $body = "<h2>Registration Information:</h2>"; $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"> <h2 align="center">Week 2 Project--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...
Zurev Posted May 7, 2011 Share Posted May 7, 2011 Change your form tag to be: <form action="" method="post"> And let us know if it persists. Quote Link to comment Share on other sites More sharing options...
teddyb Posted May 7, 2011 Share Posted May 7, 2011 Your script sends a message when the form is first requested too? Quote Link to comment Share on other sites More sharing options...
Wolverine68 Posted May 7, 2011 Author Share Posted May 7, 2011 No, same error when adding "action=""" Quote Link to comment Share on other sites More sharing options...
teddyb Posted May 7, 2011 Share Posted May 7, 2011 what about method="POST" youre using iis right? Quote Link to comment Share on other sites More sharing options...
Wolverine68 Posted May 7, 2011 Author Share Posted May 7, 2011 Are you saying I should be using "GET" instead? Quote Link to comment Share on other sites More sharing options...
teddyb Posted May 7, 2011 Share Posted May 7, 2011 no the word POST in capitals? Quote Link to comment Share on other sites More sharing options...
Wolverine68 Posted May 7, 2011 Author Share Posted May 7, 2011 Try putting "POST" in lower case? Quote Link to comment Share on other sites More sharing options...
Wolverine68 Posted May 7, 2011 Author Share Posted May 7, 2011 correction..."POST" in upper case, right? Quote Link to comment Share on other sites More sharing options...
teddyb Posted May 7, 2011 Share Posted May 7, 2011 yes! Quote Link to comment Share on other sites More sharing options...
Wolverine68 Posted May 7, 2011 Author Share Posted May 7, 2011 Changed "POST" to upper case, but still get the same error. Quote Link to comment Share on other sites More sharing options...
Wolverine68 Posted May 9, 2011 Author Share Posted May 9, 2011 Anybody have any other suggestions? 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.