Q:

Open a URL after a search

I am trying to create a search box that opens a url according to what was searched.  I have not been successful so far. 
Example:
<form>
  <input type="text" name="search" placeholder="Search." >
</form> 

And the result would open in a new page, with the string that was searched:
https://www.example.com/ + string.html 

A:

Using javascript you can achieve something like that:

document.getElementById("openLinkBtn").addEventListener("click", openLink);

function openLink() {
  var link = document.getElementById("myLink").value;
  openInNewTab("https://www.example.com/" + link + ".html");
}

function openInNewTab(url) {
  var win = window.open(url, '_blank');
  win.focus();
}
<input id="myLink" type="text" name="search" placeholder="Search." >
<button id="openLinkBtn">
  Open the link
</button>

