9ball Posted November 16, 2009 Share Posted November 16, 2009 I am very new to php and just learning from books. I create a php with a submit value=Go. and out side of the isset($_POST['submit']) I have a hyperlink that out a with target="_Blank". The problem is when the php is loaded the first time and after submit when I click on the hyperlink I will get an saying something like Method not supported submit=GoGet to /dir/abc.html HTML 1.1 Seem like some how the submit=Go is added to the Get. If I go back the the php page and click on the same link again, it will open the page. I noticed when opening a simple html for a php with form method post, I would get a Get method not supported error. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/181727-method-not-supported-error/ Share on other sites More sharing options...
KevinM1 Posted November 16, 2009 Share Posted November 16, 2009 Due to our lack of telepathy, you may want to clarify your problem by showing us some code, especially near where the error is occurring. Quote Link to comment https://forums.phpfreaks.com/topic/181727-method-not-supported-error/#findComment-958473 Share on other sites More sharing options...
9ball Posted November 16, 2009 Author Share Posted November 16, 2009 Here is the code: <?php if(!$_POST) { echo " <html> <body> <form method=\"POST\" action=\"".$_SERVER["PHP_SELF"]."\"> <input type=\"text\" name\"first\" /> <br/> <input type=\"submit\" name=\"submit\" value=\"Go\" /> </form> </body> </html>"; } else { $name = $_POST['first']; print("Your name is: $name <br/>"); print('<a href=welcome.html>Home</a>'); } ?> This is the error: Method Not Implemented =freak&submit=GoGET to /welcome.html not supported. Invalid method in request =freak&submit=GoGET /welcome.html HTTP/1.1 Apache/1.3.33 Server at www.johnleeconsulting.info Port 80 Also I entered freak on the input box but it is not printed with the print statement, how come? If I go back and click the link again the welcome.html will open. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/181727-method-not-supported-error/#findComment-958513 Share on other sites More sharing options...
premiso Posted November 16, 2009 Share Posted November 16, 2009 <input type=\"text\" name=\"first\" /> You were missing an = after the name on that line. Give that shot and see how it goes. Quote Link to comment https://forums.phpfreaks.com/topic/181727-method-not-supported-error/#findComment-958515 Share on other sites More sharing options...
9ball Posted November 16, 2009 Author Share Posted November 16, 2009 thanks permiso. Input is printing now but I still have the link issue. When I click Home this is what I got Method Not Implemented first=thanks&submit=GoGET to /welcome.html not supported. Invalid method in request first=thanks&submit=GoGET /welcome.html HTTP/1.1 Apache/1.3.33 Server at www.johnleeconsulting.info Port 80 Quote Link to comment https://forums.phpfreaks.com/topic/181727-method-not-supported-error/#findComment-958534 Share on other sites More sharing options...
KevinM1 Posted November 16, 2009 Share Posted November 16, 2009 Instead of echoing out the HTML, exit PHP to display it, like so: <?php if(!isset($_POST['submit')) { ?> <html> <body> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <input type="text" name="first" /> <br /> <input type="submit" name="submit" value="Go" /> </form> </body> </html> <?php } //<-- end if else { $name = $_POST['first']; echo "Your name is: $name<br /><a href='welcome.html'>Welcome Home</a>"; } ?> It might make it easier to debug this way. Quote Link to comment https://forums.phpfreaks.com/topic/181727-method-not-supported-error/#findComment-958541 Share on other sites More sharing options...
9ball Posted November 16, 2009 Author Share Posted November 16, 2009 Still get the same error. Method Not Implemented first=thanks&submit=GoGET to /welcome.html not supported. Invalid method in request first=thanks&submit=GoGET /welcome.html HTTP/1.1 Why and how does input text and submit are added to the GET? Quote Link to comment https://forums.phpfreaks.com/topic/181727-method-not-supported-error/#findComment-958776 Share on other sites More sharing options...
KevinM1 Posted November 16, 2009 Share Posted November 16, 2009 Still get the same error. Method Not Implemented first=thanks&submit=GoGET to /welcome.html not supported. Invalid method in request first=thanks&submit=GoGET /welcome.html HTTP/1.1 Why and how does input text and submit are added to the GET? Can you show us all your code as it stands now? Quote Link to comment https://forums.phpfreaks.com/topic/181727-method-not-supported-error/#findComment-958783 Share on other sites More sharing options...
9ball Posted November 17, 2009 Author Share Posted November 17, 2009 <?php if(!isset($_POST['submit'])) { // if(!$_POST) { ?> <!-- echo " --> <html> <body> <form method="POST" action="<?php echo $_SERVER["PHP_SELF"]; ?>"> <input type="text" name="first" /> <br/> <input type="submit" name="submit" value="Go" /> </form> </body> </html> <?php } else { $name = $_POST['first']; print("Your name is: $name <br/>"); print('<a href=welcome.html>Home</a>'); } ?> looks like any hyperlink created from php will give me the error... Quote Link to comment https://forums.phpfreaks.com/topic/181727-method-not-supported-error/#findComment-958800 Share on other sites More sharing options...
roopurt18 Posted November 17, 2009 Share Posted November 17, 2009 I would change the method="POST" to method="post"; it may not make a difference but I never see anyone use capitalized attribute values like that. Also, it would seem that submitting your form is creating a GET request to welcome.html. Is Apache configured to serve .html files through the PHP processor? Is the file this code resides in actually welcome.html? Quote Link to comment https://forums.phpfreaks.com/topic/181727-method-not-supported-error/#findComment-958806 Share on other sites More sharing options...
9ball Posted November 17, 2009 Author Share Posted November 17, 2009 The code is in a php with the form post. welcome.html is just any html file on the same directory. Don't seem to have problem when posting to itself. Only has problem when try to open any other page that are not form post. Quote Link to comment https://forums.phpfreaks.com/topic/181727-method-not-supported-error/#findComment-958814 Share on other sites More sharing options...
roopurt18 Posted November 17, 2009 Share Posted November 17, 2009 It seems some how your browser is sending the form data as the request type. Can we see this in action online somewhere? Quote Link to comment https://forums.phpfreaks.com/topic/181727-method-not-supported-error/#findComment-958885 Share on other sites More sharing options...
9ball Posted November 19, 2009 Author Share Posted November 19, 2009 Here is the link http://johnleeconsulting.info/php0001.php type something in the input box then click on Go and you will see the link to Home. Click on the link and you will get the error. If you go back on the browser and click on the link again, the page will show. Is there a way for php to know if the page is a repost or initial post? I think I only get the error on initial post. John Quote Link to comment https://forums.phpfreaks.com/topic/181727-method-not-supported-error/#findComment-961132 Share on other sites More sharing options...
roopurt18 Posted November 19, 2009 Share Posted November 19, 2009 I went to your link. I typed something in the box. Then I clicked on the 'view source' thing in IE. This is what I saw: Your name is: asdf <br/><a href=welcome.html>Home</a></iframe></noscript></object></layer></span></div></table></body></html><!-- adsok --> <script language='javascript' src='https://a12.alphagodaddy.com/hosting_ads/gd01.js'></script> That is not valid HTML code and likely the cause of your problems. Quote Link to comment https://forums.phpfreaks.com/topic/181727-method-not-supported-error/#findComment-961237 Share on other sites More sharing options...
9ball Posted November 20, 2009 Author Share Posted November 20, 2009 You maybe right. It could be that lousy godaddy's ad that is causing the problem. It works fine on another site. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/181727-method-not-supported-error/#findComment-962124 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.