Skip to main content
Participant
June 8, 2017
Answered

{"code":"MethodNotAllowedError","message":"POST is not allowed"}

  • June 8, 2017
  • 1 reply
  • 2269 views

Hi!

I have a problem with post

index.php

<html>

<head>

  <!-- Polish -->

  <meta charset="utf-8">

  <title>Przekierowywanie</title>

</head>

<body>

<form action="home.php" method="post">

  <input name="nick" type="text"> <br>

  <input name="pass" type="password"> <br> <br>

  <input type="submit">

</form>

</body>

</html>

home.php

<html>

<head>

  <!-- Polish -->

  <meta charset="utf-8">

  <title>W trakcie budowy!</title>

</head>

<body>

  <?

   //POST Nick and Password

   $ln = $_POST["nick"];

   $lp = $_POST["pass"];

   //Checking nick and password

   if ($ln == "Jan" and $lp == "hehe") {

   

   }

  ?>

</body>

</html>

Someone can help me?

This topic has been closed for replies.
Correct answer osgood_

Where are you testing the files? You need a local server set up if you are testing php files locally and are the files in the correct folder of your local server?

<?

   //POST Nick and Password

   $ln = $_POST["nick"];

   $lp = $_POST["pass"];

   //Checking nick and password

   if ($ln == "Jan" and $lp == "hehe") {

   }

  ?>

If you do have a local server set up and all the files are correctly located within your local server then another possiblily is it doesnt like the <? short opening php tag - try changing it to <?php

My best guess is you don't have a local server set up. You would need to download and install a free one - either WAMP or XAMMP or MAMP - do a Google search

1 reply

osgood_Correct answer
Legend
June 8, 2017

Where are you testing the files? You need a local server set up if you are testing php files locally and are the files in the correct folder of your local server?

<?

   //POST Nick and Password

   $ln = $_POST["nick"];

   $lp = $_POST["pass"];

   //Checking nick and password

   if ($ln == "Jan" and $lp == "hehe") {

   }

  ?>

If you do have a local server set up and all the files are correctly located within your local server then another possiblily is it doesnt like the <? short opening php tag - try changing it to <?php

My best guess is you don't have a local server set up. You would need to download and install a free one - either WAMP or XAMMP or MAMP - do a Google search