I'm trying to make a simple search for Wikipedia where I can type what I want to search and a select where I can select the language. What I'm trying to do is to get the select value to be able to search in different languages so I just replace the language string in the url of wikipedia.org
(e.g. If I select French in the select dropdown the form should redirects me to fr.wikipedia.org and if I select English, it should redirects me to en.wikipedia.org)
Here's what I tried so far:
<form action="https://<?php $_POST["language"] ?>.wikipedia.org/w/index.php">
<input name="search" type="text" />
<select name="language">
<option value="en">English</option>
<option value="fr">French</option>
</select>
</form>
Now, on submit I get this url: https://.wikipedia.org/w/index.php?search=cat
How to pass select value to form action so I can add it at the start of the URL?