HTTP ERROR 405 on Form Submit

I have a form where the action attribute leads to another page ../approve/.
I also have a Next button with a type attribute of submit, and method - post.

The problem is when I click on the Next button, it takes me to the right link, but with an error.

If I copy the link and paste it into another tab, it works.
What is the cause of this and how can it be fixed?

Here's my code...
<form action="../approve/" method="post">
  <div class="form-title mb-4">Enter loan amount</div>
  <div class="form-fields mb-4">
    <!-- Form Field -->
    <div class="form-field">
      <label for="duration">Duration
        <img src="/assets/images/info-icon.svg" alt="info icon" class="info-icon" /></label>
      <div class="form-input duration">
        <input type="number" placeholder="0" id="duration" />
        <span>Days</span>
      </div>
    </div>
    <!-- Form Field -->
    <div class="form-field">
      <label for="amount">Loan amount</label>
      <div class="form-input amount">
        <span><img src="/assets/images/solana-1.svg" alt="solana icon" /></span>
        <input type="number" placeholder="0" id="amount" />
      </div>
    </div>
    <!-- Form Field -->
  </div>
  <div class="form-info mb-5">
    <div class="form-info__item">
      <div class="title green-text">
        Maximum repayment
        <img src="/assets/images/info-icon.svg" alt="info icon" class="info-icon" />
      </div>
      <div class="value solana-amount">
        <img src="/assets/images/solana.svg" alt="solana icon" />
        13.05
      </div>
    </div>
    <div class="form-info__item">
      <div class="title">
        LTF
        <img src="/assets/images/info-icon.svg" alt="info icon" class="info-icon" />
      </div>
      <div class="value">142.1%</div>
    </div>
  </div>
  <div class="form-btn approval__cta">
    <button type="button" class="back me-3" onclick="history.back()">
      Back
    </button>
    <button type="submit" class="loan">Next</button>
  </div>
</form>

Hi @jeremy0x,
Can you post the html for the approve page?

Okay. Here it is…

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta name="theme-color" content="#100420" />

  <!-- Primary Meta Tags -->
  <title>Create Loan Listing | P2P Loans — SentFi</title>
  <meta name="title" content="SentFi — The Anti-Scam and Anti-Rugpull Defi Platform" />
  <meta name="description"
    content="SentFI is a  platform, that protects web3 users from scams and supports personal and business loans, p2p commerce, NFT insurance & anti-rug pull for NFT investors." />

  <!-- Open Graph / Facebook -->
  <meta property="og:type" content="website" />
  <meta property="og:url" content="https://sentfi.xyz/" />
  <meta property="og:title" content="SentFi — The Anti-Scam and Anti-Rugpull Defi Platform" />
  <meta property="og:description"
    content="SentFI is a  platform, that protects web3 users from scams and supports personal and business loans, p2p commerce, NFT insurance & anti-rug pull for NFT investors." />
  <meta property="og:image" content="https://i.ibb.co/nwQP5rY/image.png" />
  <meta property="og:site_name" content="SentFi" />

  <!-- Twitter -->
  <meta property="twitter:card" content="summary_large_image" />
  <meta property="twitter:url" content="https://sentfi.xyz/" />
  <meta property="twitter:title" content="SentFi — The Anti-Scam and Anti-Rugpull Defi Platform" />
  <meta property="twitter:description"
    content="SentFI is a  platform, that protects web3 users from scams and supports personal and business loans, p2p commerce, NFT insurance & anti-rug pull for NFT investors." />
  <meta property="twitter:image" content="https://i.ibb.co/nwQP5rY/image.png" />

  <!-- Icons -->
  <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
  <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
  <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
  <link rel="manifest" href="/site.webmanifest" />

  <!-- Fonts -->
  <link rel="preconnect" href="https://fonts.gstatic.com" />
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap"
    rel="stylesheet" />

  <!-- Styles -->
  <link rel="stylesheet" href="/assets/css/style.css  " />

  <!-- Font Awesome Kit -->
  <script src="https://kit.fontawesome.com/d778668bce.js" crossorigin="anonymous" defer></script>

  <!-- Scripts -->
  <script src="/assets/js/dropdown.js" defer></script>
  <script src="/assets/js/faviconChange.js" defer></script>

  <!-- Global site tag (gtag.js) - Google Analytics -->
  <!-- google analytics code -->
</head>

<body class="page-with-sidebar">
  <div class="get-loan-container">
    <header>
      <!-- navbar -->
      <nav class="top-nav px-4">
        <div class="header__logo">
          <a href="/" class="text-decoration-none"><img src="/assets/images/logo.svg" alt="SentFi" /></a>
        </div>
        <div class="header__search">
          <input type="text" placeholder="Search for collections" />
          <img src="/assets/images/search.svg" alt="Search" />
        </div>
        <div class="header__cta">
          <a title="Profile" href="" class="text-decoration-none">
            <img src="/assets/images/profile-icon.svg" alt="profile icon" />
          </a>
          <a title="Wallet" href="javascript:" class="text-decoration-none fw-bold relative">
            <img src="/assets/images/eth-1.svg" alt="ethereum icon" />
            ETH
            <i class="fa-solid fa-chevron-down fa-xs"></i>
          </a>

          <a title="Wallet" href="" class="text-decoration-none">
            <img src="/assets/images/wallet.svg" alt="wallet icon" /></a>
        </div>
      </nav>
      <!-- navbar -->
    </header>
    <!-- sidebar -->
    <!-- I removed the sidebar code to reduce the amount of code here -->
    <!-- sidebar -->
    <main class="page-with-sidebar get-instant-loan">
      <!-- **HERO** -->
      <section class="hero mt-3">
        <div class="hero-left">
          <h1 class="hero-title mb-2">Create loan listing</h1>
          <p class="mb-4">
            Select your collacterized NFT’s and your terms.
          </p>
          <div class="timeline">
            <div class="timeline__item">
              <div class="number">
                <span>1</span>
                <span class="line"></span>
              </div>
              <div class="text">
                <span> Sellect NFT Collacteral </span>
              </div>
            </div>
            <div class="timeline__item">
              <div class="number">
                <span>2</span>
                <span class="line"></span>
              </div>
              <div class="text">
                <span> Enter Terms </span>
              </div>
            </div>
            <div class="timeline__item">
              <div class="number">
                <span class="active">3</span>
              </div>
              <div class="text">
                <span class="active"> Approve </span>
              </div>
            </div>
          </div>
        </div>
        <div class="hero-right mt-4">
          <a href="javascript:" class="green-text">
            View Verified Collections
            <img src="/assets/images/info-icon.svg" alt="info-icon" />
          </a>
        </div>

        <div class="hero__blur-bg"></div>
      </section>

      <!-- **APPROVAL** -->
      <section class="approval">
        <h2 class="approval__title mb-4">Approval</h2>
        <div class="approval__description">
          <p class="mb-3">
            Kindly note that your NFT collacteral(s) will be transfered to
            SentFi's escrow contract.
          </p>
          <p class="mb-4">
            I acknowlege that failure to return
            <span class="red-text">1 SOL</span> after
            <span class="red-text">20 days</span> from loan funding, will
            forfeit my ownership of Coin #900
          </p>
        </div>
        <div class="approval__cta">
          <button type="button" class="back me-3" onclick="history.back()">
            Back
          </button>
          <button type="submit" class="loan">List now</button>
        </div>
      </section>
    </main>
  </div>
</body>

</html>

I’m not sure how to do that. The approve page is just HTML, and I’m still running locally.
So the URL is my localhost.

Is there a way to configure an HTML page to accept POST requests?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.