0

[HTML] So I want a simple website where the user is asked for input (will be order number) and when they click submit it sends them to a website using the inputted data in the URL.

I searched everywhere and cant find out how to do this.

I tried this with no luck.

<h1> Whats your name ? </h1>
<form method="POST">
  <input type="text" id="tt" placeholder="Enter Name : ">
</form>
<button onclick="my()">Submit now</button>
<p id="demo"></p>
</div>
MefAldemisov
  • 867
  • 10
  • 21
Oze
  • 61
  • 8
  • 2
    Funnily enough, I put the title of this post in google search and the first result contains the answer for you: https://www.codeproject.com/Questions/1237315/Get-value-of-input-and-redirect-to-that-url-which – waterbyte Jul 13 '20 at 17:32
  • Trying to do with HTML though. Thank you for the help! – Oze Jul 13 '20 at 17:36
  • I wanna host this on a website – Oze Jul 13 '20 at 17:36
  • Does this answer your question? [Javascript URL Redirection based on a text box](https://stackoverflow.com/questions/14448147/javascript-url-redirection-based-on-a-text-box) – Vijay Palaskar Jul 13 '20 at 18:35

1 Answers1

0

You need to send a GET request if you want to send data in the URL:

<form action="yourURL" method="get">
  <label for="orderNumber">Order number:</label>
  <input type="text" id="orderNumber" name="orderNumber">
  <button>Submit now</button>
</form>

For more information about HTML forms, please read the MDN docs.

Daemon Beast
  • 2,794
  • 3
  • 12
  • 29