How to hide button value in url?

This is my search form:

   <form action="" method="get" name="search">
   <input name="s" type="text" size="40" value="<?php echo $_GET["s"]; ?>" />
   <input name="submit" type="submit" value="Search" />
   </form>

When someone clicks the search button, the URL in the address bar of the browser looks something like this:

http://example.com/?s=someting&submit=Search

How can I change it so that it only displays:

http://example.com/?s=someting

I hope I understand ...

+5
source share
2 answers

Remove name = "submit" using the button <input type="submit">

+9
source

Like "Ivar Bonsaksen", you need to remove the "name" attribute, because it the value of every tag in the Form tag with a name attributewill be sent to the server and appears in the URL.

PS: You can use the POST method instead of GET to hide all variables and values.

0
source

All Articles