This works if submitted - you don't need to add the query string - if it were an <a href="...  then you would need the full query string for the url:
 <form action="php/test.htm" method="get">
         <td>Instruccion SQL:</td>
         <td>
         <input type="text" name="codecosult" required/>
         </td>
 <input type="submit" name="submit" value="Submit" />
 </form>
This gives me my url + /php/test.htm?codecosult=ghrth&submit=Submit
ghrth was what I had typed.
If you are submitting it with a script leave the query string off and let the "GET" method deal with it - script here is in the head.
<script language="javascript">function submit_this(){this.form.submit();}</script>
</head>
    <body>
         <form name="form" id="form" action="php/test.htm" method="GET">
                  <td>Instruccion SQL:</td>
                  <td>
                  <input type="text" name="codecosult" id="codecosult" required/>
                  </td>
         <div onClick="submit_this();">Submit</div> 
This gives me my url + test.htm?codecosult=dfthwrth
dfthwrth was what I had typed.
This also works, though the <a href="...'s hrefis modified here by the keypress event each time a key is pressed (may not work in all browsers):
 <input type="text" name="codecosult" onKeyPress="ahreff.href='php/test.htm?'+this.value;" required/>
 <a href="#" id="ahreff">Click Here</a>
This might be of interest - a dropdown will pass its value in the same way:
dropdown menu doesn't function  - it will now!